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 820 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
831 } | 831 } |
832 } | 832 } |
833 | 833 |
834 @override | 834 @override |
835 js.Expression visitTypeExpression(tree_ir.TypeExpression node) { | 835 js.Expression visitTypeExpression(tree_ir.TypeExpression node) { |
836 List<js.Expression> arguments = visitExpressionList(node.arguments); | 836 List<js.Expression> arguments = visitExpressionList(node.arguments); |
837 return glue.generateTypeRepresentation(node.dartType, arguments, registry); | 837 return glue.generateTypeRepresentation(node.dartType, arguments, registry); |
838 } | 838 } |
839 | 839 |
840 js.Node handleForeignCode(tree_ir.ForeignCode node) { | 840 js.Node handleForeignCode(tree_ir.ForeignCode node) { |
841 registry.registerStaticUse(node.dependency); | 841 if (node.dependency != null) { |
sigurdm
2015/10/26 15:04:10
Add comment - why can node.dependency be null?
Johnni Winther
2015/10/27 10:33:51
Done.
| |
842 registry.registerStaticUse(node.dependency); | |
843 } | |
842 // TODO(sra): Should this be in CodegenRegistry? | 844 // TODO(sra): Should this be in CodegenRegistry? |
843 glue.registerNativeBehavior(node.nativeBehavior, node); | 845 glue.registerNativeBehavior(node.nativeBehavior, node); |
844 return node.codeTemplate.instantiate(visitExpressionList(node.arguments)); | 846 return node.codeTemplate.instantiate(visitExpressionList(node.arguments)); |
845 } | 847 } |
846 | 848 |
847 @override | 849 @override |
848 js.Expression visitForeignExpression(tree_ir.ForeignExpression node) { | 850 js.Expression visitForeignExpression(tree_ir.ForeignExpression node) { |
849 return handleForeignCode(node); | 851 return handleForeignCode(node); |
850 } | 852 } |
851 | 853 |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1041 void registerDefaultParameterValues(ExecutableElement element) { | 1043 void registerDefaultParameterValues(ExecutableElement element) { |
1042 if (element is! FunctionElement) return; | 1044 if (element is! FunctionElement) return; |
1043 FunctionElement function = element; | 1045 FunctionElement function = element; |
1044 if (function.isStatic) return; // Defaults are inlined at call sites. | 1046 if (function.isStatic) return; // Defaults are inlined at call sites. |
1045 function.functionSignature.forEachOptionalParameter((param) { | 1047 function.functionSignature.forEachOptionalParameter((param) { |
1046 ConstantValue constant = glue.getDefaultParameterValue(param); | 1048 ConstantValue constant = glue.getDefaultParameterValue(param); |
1047 registry.registerCompileTimeConstant(constant); | 1049 registry.registerCompileTimeConstant(constant); |
1048 }); | 1050 }); |
1049 } | 1051 } |
1050 } | 1052 } |
OLD | NEW |