| 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 '../../closure.dart' show ClosureClassElement; | 9 import '../../closure.dart' show ClosureClassElement; |
| 10 import '../../common/codegen.dart' show CodegenRegistry; | 10 import '../../common/codegen.dart' show CodegenRegistry; |
| (...skipping 820 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 831 js.Expression visitForeignExpression(tree_ir.ForeignExpression node) { | 831 js.Expression visitForeignExpression(tree_ir.ForeignExpression node) { |
| 832 return handleForeignCode(node); | 832 return handleForeignCode(node); |
| 833 } | 833 } |
| 834 | 834 |
| 835 @override | 835 @override |
| 836 void visitForeignStatement(tree_ir.ForeignStatement node) { | 836 void visitForeignStatement(tree_ir.ForeignStatement node) { |
| 837 accumulator.add(handleForeignCode(node)); | 837 accumulator.add(handleForeignCode(node)); |
| 838 } | 838 } |
| 839 | 839 |
| 840 @override | 840 @override |
| 841 void visitYield(tree_ir.Yield node) { |
| 842 js.Expression value = visitExpression(node.input); |
| 843 accumulator.add(new js.DartYield(value, node.hasStar)); |
| 844 } |
| 845 |
| 846 @override |
| 841 js.Expression visitApplyBuiltinOperator(tree_ir.ApplyBuiltinOperator node) { | 847 js.Expression visitApplyBuiltinOperator(tree_ir.ApplyBuiltinOperator node) { |
| 842 List<js.Expression> args = visitExpressionList(node.arguments); | 848 List<js.Expression> args = visitExpressionList(node.arguments); |
| 843 switch (node.operator) { | 849 switch (node.operator) { |
| 844 case BuiltinOperator.NumAdd: | 850 case BuiltinOperator.NumAdd: |
| 845 return new js.Binary('+', args[0], args[1]); | 851 return new js.Binary('+', args[0], args[1]); |
| 846 case BuiltinOperator.NumSubtract: | 852 case BuiltinOperator.NumSubtract: |
| 847 return new js.Binary('-', args[0], args[1]); | 853 return new js.Binary('-', args[0], args[1]); |
| 848 case BuiltinOperator.NumMultiply: | 854 case BuiltinOperator.NumMultiply: |
| 849 return new js.Binary('*', args[0], args[1]); | 855 return new js.Binary('*', args[0], args[1]); |
| 850 case BuiltinOperator.NumAnd: | 856 case BuiltinOperator.NumAnd: |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 909 js.Expression visitAwait(tree_ir.Await node) { | 915 js.Expression visitAwait(tree_ir.Await node) { |
| 910 return new js.Await(visitExpression(node.input)); | 916 return new js.Await(visitExpression(node.input)); |
| 911 } | 917 } |
| 912 | 918 |
| 913 visitFunctionExpression(tree_ir.FunctionExpression node) { | 919 visitFunctionExpression(tree_ir.FunctionExpression node) { |
| 914 // FunctionExpressions are currently unused. | 920 // FunctionExpressions are currently unused. |
| 915 // We might need them if we want to emit raw JS nested functions. | 921 // We might need them if we want to emit raw JS nested functions. |
| 916 throw 'FunctionExpressions should not be used'; | 922 throw 'FunctionExpressions should not be used'; |
| 917 } | 923 } |
| 918 } | 924 } |
| OLD | NEW |