| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 dart2js.compile_time_constant_evaluator; | 5 library dart2js.compile_time_constant_evaluator; |
| 6 | 6 |
| 7 import 'common.dart'; | 7 import 'common.dart'; |
| 8 import 'common/resolution.dart' show | 8 import 'common/resolution.dart' show |
| 9 Resolution; | 9 Resolution; |
| 10 import 'common/tasks.dart' show | 10 import 'common/tasks.dart' show |
| (...skipping 1133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1144 | 1144 |
| 1145 if (initializerList != null) { | 1145 if (initializerList != null) { |
| 1146 for (Link<Node> link = initializerList.nodes; | 1146 for (Link<Node> link = initializerList.nodes; |
| 1147 !link.isEmpty; | 1147 !link.isEmpty; |
| 1148 link = link.tail) { | 1148 link = link.tail) { |
| 1149 assert(link.head is Send); | 1149 assert(link.head is Send); |
| 1150 if (link.head is! SendSet) { | 1150 if (link.head is! SendSet) { |
| 1151 // A super initializer or constructor redirection. | 1151 // A super initializer or constructor redirection. |
| 1152 Send call = link.head; | 1152 Send call = link.head; |
| 1153 FunctionElement target = elements[call]; | 1153 FunctionElement target = elements[call]; |
| 1154 List<AstConstant> compiledArguments = evaluateArgumentsToConstructor( | 1154 if (!target.isMalformed) { |
| 1155 call, elements.getSelector(call).callStructure, call.arguments, | 1155 List<AstConstant> compiledArguments = |
| 1156 target, compileArgument: evaluateConstant); | 1156 evaluateArgumentsToConstructor( |
| 1157 evaluateSuperOrRedirectSend(compiledArguments, target); | 1157 call, |
| 1158 elements.getSelector(call).callStructure, |
| 1159 call.arguments, |
| 1160 target, |
| 1161 compileArgument: evaluateConstant); |
| 1162 evaluateSuperOrRedirectSend(compiledArguments, target); |
| 1163 } |
| 1158 foundSuperOrRedirect = true; | 1164 foundSuperOrRedirect = true; |
| 1159 } else { | 1165 } else { |
| 1160 // A field initializer. | 1166 // A field initializer. |
| 1161 SendSet init = link.head; | 1167 SendSet init = link.head; |
| 1162 Link<Node> initArguments = init.arguments; | 1168 Link<Node> initArguments = init.arguments; |
| 1163 assert(!initArguments.isEmpty && initArguments.tail.isEmpty); | 1169 assert(!initArguments.isEmpty && initArguments.tail.isEmpty); |
| 1164 AstConstant fieldValue = evaluate(initArguments.head); | 1170 AstConstant fieldValue = evaluate(initArguments.head); |
| 1165 updateFieldValue(init, elements[init], fieldValue); | 1171 updateFieldValue(init, elements[init], fieldValue); |
| 1166 } | 1172 } |
| 1167 } | 1173 } |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1272 class _CompilerEnvironment implements Environment { | 1278 class _CompilerEnvironment implements Environment { |
| 1273 final Compiler compiler; | 1279 final Compiler compiler; |
| 1274 | 1280 |
| 1275 _CompilerEnvironment(this.compiler); | 1281 _CompilerEnvironment(this.compiler); |
| 1276 | 1282 |
| 1277 @override | 1283 @override |
| 1278 String readFromEnvironment(String name) { | 1284 String readFromEnvironment(String name) { |
| 1279 return compiler.fromEnvironment(name); | 1285 return compiler.fromEnvironment(name); |
| 1280 } | 1286 } |
| 1281 } | 1287 } |
| OLD | NEW |