Chromium Code Reviews| 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 845 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 856 visitExpressionList(node.arguments)); | 856 visitExpressionList(node.arguments)); |
| 857 js.Expression argumentNames = new js.ArrayInitializer( | 857 js.Expression argumentNames = new js.ArrayInitializer( |
| 858 node.selector.namedArguments.map(js.string).toList(growable: false)); | 858 node.selector.namedArguments.map(js.string).toList(growable: false)); |
| 859 return buildStaticHelperInvocation(glue.createInvocationMirrorMethod, | 859 return buildStaticHelperInvocation(glue.createInvocationMirrorMethod, |
| 860 <js.Expression>[name, internalName, kind, arguments, argumentNames]); | 860 <js.Expression>[name, internalName, kind, arguments, argumentNames]); |
| 861 } | 861 } |
| 862 | 862 |
| 863 @override | 863 @override |
| 864 js.Expression visitInterceptor(tree_ir.Interceptor node) { | 864 js.Expression visitInterceptor(tree_ir.Interceptor node) { |
| 865 registry.registerUseInterceptor(); | 865 registry.registerUseInterceptor(); |
| 866 registry.registerSpecializedGetInterceptor(node.interceptedClasses); | 866 // Default to all intercepted classes if they have not been computed. |
|
sra1
2016/01/08 03:24:04
Does the lack of a recomputed result is mean somet
asgerf
2016/01/08 17:17:48
Just to decouple passes. Added comment.
| |
| 867 js.Name helperName = glue.getInterceptorName(node.interceptedClasses); | 867 Set<ClassElement> interceptedClasses = node.interceptedClasses.isEmpty |
| 868 ? glue.interceptedClasses | |
| 869 : node.interceptedClasses; | |
| 870 registry.registerSpecializedGetInterceptor(interceptedClasses); | |
| 871 js.Name helperName = glue.getInterceptorName(interceptedClasses); | |
| 868 js.Expression globalHolder = glue.getInterceptorLibrary(); | 872 js.Expression globalHolder = glue.getInterceptorLibrary(); |
| 869 return js.js('#.#(#)', | 873 return js.js('#.#(#)', |
| 870 [globalHolder, helperName, visitExpression(node.input)]) | 874 [globalHolder, helperName, visitExpression(node.input)]) |
| 871 .withSourceInformation(node.sourceInformation); | 875 .withSourceInformation(node.sourceInformation); |
| 872 } | 876 } |
| 873 | 877 |
| 874 @override | 878 @override |
| 875 js.Expression visitGetField(tree_ir.GetField node) { | 879 js.Expression visitGetField(tree_ir.GetField node) { |
| 876 registry.registerStaticUse(new StaticUse.fieldGet(node.field)); | 880 registry.registerStaticUse(new StaticUse.fieldGet(node.field)); |
| 877 return new js.PropertyAccess( | 881 return new js.PropertyAccess( |
| (...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1214 void registerDefaultParameterValues(ExecutableElement element) { | 1218 void registerDefaultParameterValues(ExecutableElement element) { |
| 1215 if (element is! FunctionElement) return; | 1219 if (element is! FunctionElement) return; |
| 1216 FunctionElement function = element; | 1220 FunctionElement function = element; |
| 1217 if (function.isStatic) return; // Defaults are inlined at call sites. | 1221 if (function.isStatic) return; // Defaults are inlined at call sites. |
| 1218 function.functionSignature.forEachOptionalParameter((param) { | 1222 function.functionSignature.forEachOptionalParameter((param) { |
| 1219 ConstantValue constant = glue.getDefaultParameterValue(param); | 1223 ConstantValue constant = glue.getDefaultParameterValue(param); |
| 1220 registry.registerCompileTimeConstant(constant); | 1224 registry.registerCompileTimeConstant(constant); |
| 1221 }); | 1225 }); |
| 1222 } | 1226 } |
| 1223 } | 1227 } |
| OLD | NEW |