| 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 | 9 import '../../closure.dart' show |
| 10 ClosureClassElement; | 10 ClosureClassElement; |
| (...skipping 877 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 888 | 888 |
| 889 @override | 889 @override |
| 890 void visitForeignStatement(tree_ir.ForeignStatement node) { | 890 void visitForeignStatement(tree_ir.ForeignStatement node) { |
| 891 accumulator.add(handleForeignCode(node)); | 891 accumulator.add(handleForeignCode(node)); |
| 892 } | 892 } |
| 893 | 893 |
| 894 @override | 894 @override |
| 895 void visitYield(tree_ir.Yield node) { | 895 void visitYield(tree_ir.Yield node) { |
| 896 js.Expression value = visitExpression(node.input); | 896 js.Expression value = visitExpression(node.input); |
| 897 accumulator.add(new js.DartYield(value, node.hasStar)); | 897 accumulator.add(new js.DartYield(value, node.hasStar)); |
| 898 visitStatement(node.next); |
| 898 } | 899 } |
| 899 | 900 |
| 900 @override | 901 @override |
| 901 js.Expression visitApplyBuiltinOperator(tree_ir.ApplyBuiltinOperator node) { | 902 js.Expression visitApplyBuiltinOperator(tree_ir.ApplyBuiltinOperator node) { |
| 902 List<js.Expression> args = visitExpressionList(node.arguments); | 903 List<js.Expression> args = visitExpressionList(node.arguments); |
| 903 switch (node.operator) { | 904 switch (node.operator) { |
| 904 case BuiltinOperator.NumAdd: | 905 case BuiltinOperator.NumAdd: |
| 905 return new js.Binary('+', args[0], args[1]); | 906 return new js.Binary('+', args[0], args[1]); |
| 906 case BuiltinOperator.NumSubtract: | 907 case BuiltinOperator.NumSubtract: |
| 907 return new js.Binary('-', args[0], args[1]); | 908 return new js.Binary('-', args[0], args[1]); |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1079 void registerDefaultParameterValues(ExecutableElement element) { | 1080 void registerDefaultParameterValues(ExecutableElement element) { |
| 1080 if (element is! FunctionElement) return; | 1081 if (element is! FunctionElement) return; |
| 1081 FunctionElement function = element; | 1082 FunctionElement function = element; |
| 1082 if (function.isStatic) return; // Defaults are inlined at call sites. | 1083 if (function.isStatic) return; // Defaults are inlined at call sites. |
| 1083 function.functionSignature.forEachOptionalParameter((param) { | 1084 function.functionSignature.forEachOptionalParameter((param) { |
| 1084 ConstantValue constant = glue.getDefaultParameterValue(param); | 1085 ConstantValue constant = glue.getDefaultParameterValue(param); |
| 1085 registry.registerCompileTimeConstant(constant); | 1086 registry.registerCompileTimeConstant(constant); |
| 1086 }); | 1087 }); |
| 1087 } | 1088 } |
| 1088 } | 1089 } |
| OLD | NEW |