| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 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 | 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. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library code_generator; | 5 library code_generator; |
| 6 | 6 |
| 7 import 'glue.dart'; | 7 import 'glue.dart'; |
| 8 | 8 |
| 9 import '../../tree_ir/tree_ir_nodes.dart' as tree_ir; | 9 import '../../tree_ir/tree_ir_nodes.dart' as tree_ir; |
| 10 import '../../tree_ir/tree_ir_nodes.dart' show BuiltinOperator; | 10 import '../../tree_ir/tree_ir_nodes.dart' show BuiltinOperator; |
| (...skipping 683 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 694 registry.registerStaticUse(node.dependency); | 694 registry.registerStaticUse(node.dependency); |
| 695 return node.codeTemplate.instantiate(visitExpressionList(node.arguments)); | 695 return node.codeTemplate.instantiate(visitExpressionList(node.arguments)); |
| 696 } | 696 } |
| 697 | 697 |
| 698 @override | 698 @override |
| 699 js.Expression visitForeignExpression(tree_ir.ForeignExpression node) { | 699 js.Expression visitForeignExpression(tree_ir.ForeignExpression node) { |
| 700 return handleForeignCode(node); | 700 return handleForeignCode(node); |
| 701 } | 701 } |
| 702 | 702 |
| 703 @override | 703 @override |
| 704 visitForeignStatement(tree_ir.ForeignStatement node) { | 704 void visitForeignStatement(tree_ir.ForeignStatement node) { |
| 705 return handleForeignCode(node); | 705 accumulator.add(handleForeignCode(node)); |
| 706 } | 706 } |
| 707 | 707 |
| 708 @override | 708 @override |
| 709 js.Expression visitApplyBuiltinOperator(tree_ir.ApplyBuiltinOperator node) { | 709 js.Expression visitApplyBuiltinOperator(tree_ir.ApplyBuiltinOperator node) { |
| 710 List<js.Expression> args = visitExpressionList(node.arguments); | 710 List<js.Expression> args = visitExpressionList(node.arguments); |
| 711 switch (node.operator) { | 711 switch (node.operator) { |
| 712 case BuiltinOperator.NumAdd: | 712 case BuiltinOperator.NumAdd: |
| 713 return new js.Binary('+', args[0], args[1]); | 713 return new js.Binary('+', args[0], args[1]); |
| 714 case BuiltinOperator.NumSubtract: | 714 case BuiltinOperator.NumSubtract: |
| 715 return new js.Binary('-', args[0], args[1]); | 715 return new js.Binary('-', args[0], args[1]); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 755 return js.js("typeof # === 'number' && Math.floor(#) === #", args); | 755 return js.js("typeof # === 'number' && Math.floor(#) === #", args); |
| 756 } | 756 } |
| 757 } | 757 } |
| 758 | 758 |
| 759 visitFunctionExpression(tree_ir.FunctionExpression node) { | 759 visitFunctionExpression(tree_ir.FunctionExpression node) { |
| 760 // FunctionExpressions are currently unused. | 760 // FunctionExpressions are currently unused. |
| 761 // We might need them if we want to emit raw JS nested functions. | 761 // We might need them if we want to emit raw JS nested functions. |
| 762 throw 'FunctionExpressions should not be used'; | 762 throw 'FunctionExpressions should not be used'; |
| 763 } | 763 } |
| 764 } | 764 } |
| OLD | NEW |