| 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 974 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 985 | 985 |
| 986 @override | 986 @override |
| 987 js.Expression visitTypeExpression(tree_ir.TypeExpression node) { | 987 js.Expression visitTypeExpression(tree_ir.TypeExpression node) { |
| 988 List<js.Expression> arguments = visitExpressionList(node.arguments); | 988 List<js.Expression> arguments = visitExpressionList(node.arguments); |
| 989 switch (node.kind) { | 989 switch (node.kind) { |
| 990 case tree_ir.TypeExpressionKind.COMPLETE: | 990 case tree_ir.TypeExpressionKind.COMPLETE: |
| 991 return glue.generateTypeRepresentation( | 991 return glue.generateTypeRepresentation( |
| 992 node.dartType, arguments, registry); | 992 node.dartType, arguments, registry); |
| 993 case tree_ir.TypeExpressionKind.INSTANCE: | 993 case tree_ir.TypeExpressionKind.INSTANCE: |
| 994 // We expect only flat types for the INSTANCE representation. | 994 // We expect only flat types for the INSTANCE representation. |
| 995 assert(node.dartType == node.dartType.element.thisType); | 995 assert(node.dartType == |
| 996 (node.dartType.element as ClassElement).thisType); |
| 996 registry.registerInstantiatedClass(glue.listClass); | 997 registry.registerInstantiatedClass(glue.listClass); |
| 997 return new js.ArrayInitializer(arguments); | 998 return new js.ArrayInitializer(arguments); |
| 998 } | 999 } |
| 999 } | 1000 } |
| 1000 | 1001 |
| 1001 js.Node handleForeignCode(tree_ir.ForeignCode node) { | 1002 js.Node handleForeignCode(tree_ir.ForeignCode node) { |
| 1002 if (node.dependency != null) { | 1003 if (node.dependency != null) { |
| 1003 // Dependency is only used if [node] calls a Dart function. Currently only | 1004 // Dependency is only used if [node] calls a Dart function. Currently only |
| 1004 // through foreign function `RAW_DART_FUNCTION_REF`. | 1005 // through foreign function `RAW_DART_FUNCTION_REF`. |
| 1005 registry.registerStaticUse( | 1006 registry.registerStaticUse( |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1233 void registerDefaultParameterValues(ExecutableElement element) { | 1234 void registerDefaultParameterValues(ExecutableElement element) { |
| 1234 if (element is! FunctionElement) return; | 1235 if (element is! FunctionElement) return; |
| 1235 FunctionElement function = element; | 1236 FunctionElement function = element; |
| 1236 if (function.isStatic) return; // Defaults are inlined at call sites. | 1237 if (function.isStatic) return; // Defaults are inlined at call sites. |
| 1237 function.functionSignature.forEachOptionalParameter((param) { | 1238 function.functionSignature.forEachOptionalParameter((param) { |
| 1238 ConstantValue constant = glue.getDefaultParameterValue(param); | 1239 ConstantValue constant = glue.getDefaultParameterValue(param); |
| 1239 registry.registerCompileTimeConstant(constant); | 1240 registry.registerCompileTimeConstant(constant); |
| 1240 }); | 1241 }); |
| 1241 } | 1242 } |
| 1242 } | 1243 } |
| OLD | NEW |