| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 |
| 5 library js_tree_ir_builder; |
| 6 |
| 7 import '../../tree_ir/tree_ir_builder.dart' show Builder; |
| 8 import 'glue.dart' show Glue; |
| 9 import '../../dart2jslib.dart' show Selector, InternalErrorFunction; |
| 10 import '../../elements/elements.dart'; |
| 11 import '../../cps_ir/cps_ir_nodes.dart' as cps_ir; |
| 12 import '../../tree_ir/tree_ir_nodes.dart'; |
| 13 |
| 14 /// Subclass of [Builder] that can translate nodes which are specific to the |
| 15 /// JavaScript backend. |
| 16 class JsTreeBuilder extends Builder { |
| 17 final Glue _glue; |
| 18 final Element identicalFunction; |
| 19 |
| 20 JsTreeBuilder( |
| 21 InternalErrorFunction internalError, |
| 22 this.identicalFunction, |
| 23 this._glue, |
| 24 [Builder parent]) |
| 25 : super(internalError, parent); |
| 26 |
| 27 JsTreeBuilder createInnerBuilder() { |
| 28 return new JsTreeBuilder(internalError, identicalFunction, _glue, this); |
| 29 } |
| 30 |
| 31 Selector get identicalSelector { |
| 32 return new Selector.call('identical', null, 2); |
| 33 } |
| 34 |
| 35 Expression visitIdentical(cps_ir.Identical node) { |
| 36 return new InvokeStatic( |
| 37 identicalFunction, |
| 38 identicalSelector, |
| 39 <Expression>[getVariableReference(node.left), |
| 40 getVariableReference(node.right)]); |
| 41 } |
| 42 |
| 43 Expression visitInterceptor(cps_ir.Interceptor node) { |
| 44 Element getInterceptor = _glue.getInterceptorMethod; |
| 45 _glue.registerUseInterceptorInCodegen(); |
| 46 return new InvokeStatic( |
| 47 getInterceptor, |
| 48 new Selector.fromElement(getInterceptor), |
| 49 <Expression>[getVariableReference(node.input)]); |
| 50 } |
| 51 } |
| OLD | NEW |