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/resolution.dart' show Resolution; | 7 import 'common/resolution.dart' show Resolution; |
8 import 'common/tasks.dart' show CompilerTask, Measurer; | 8 import 'common/tasks.dart' show CompilerTask, Measurer; |
9 import 'common.dart'; | 9 import 'common.dart'; |
10 import 'compiler.dart' show Compiler; | 10 import 'compiler.dart' show Compiler; |
(...skipping 1223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1234 if (constructor.isMalformed) return; | 1234 if (constructor.isMalformed) return; |
1235 // Assign arguments to parameters. | 1235 // Assign arguments to parameters. |
1236 FunctionSignature signature = constructor.functionSignature; | 1236 FunctionSignature signature = constructor.functionSignature; |
1237 int index = 0; | 1237 int index = 0; |
1238 signature.orderedForEachParameter((ParameterElement parameter) { | 1238 signature.orderedForEachParameter((ParameterElement parameter) { |
1239 AstConstant argument = arguments[index++]; | 1239 AstConstant argument = arguments[index++]; |
1240 Node node = parameter.node; | 1240 Node node = parameter.node; |
1241 if (parameter.isInitializingFormal) { | 1241 if (parameter.isInitializingFormal) { |
1242 InitializingFormalElement initializingFormal = parameter; | 1242 InitializingFormalElement initializingFormal = parameter; |
1243 updateFieldValue(node, initializingFormal.fieldElement, argument); | 1243 updateFieldValue(node, initializingFormal.fieldElement, argument); |
1244 if (compiler.options.enableInitializingFormalAccess) { | |
1245 definitions[parameter] = argument; | |
1246 } | |
1247 } else { | 1244 } else { |
1248 potentiallyCheckType(parameter, argument); | 1245 potentiallyCheckType(parameter, argument); |
1249 definitions[parameter] = argument; | |
1250 } | 1246 } |
| 1247 definitions[parameter] = argument; |
1251 }); | 1248 }); |
1252 } | 1249 } |
1253 | 1250 |
1254 void evaluateSuperOrRedirectSend(List<AstConstant> compiledArguments, | 1251 void evaluateSuperOrRedirectSend(List<AstConstant> compiledArguments, |
1255 CallStructure callStructure, ConstructorElement targetConstructor) { | 1252 CallStructure callStructure, ConstructorElement targetConstructor) { |
1256 InterfaceType type = | 1253 InterfaceType type = |
1257 constructedType.asInstanceOf(targetConstructor.enclosingClass); | 1254 constructedType.asInstanceOf(targetConstructor.enclosingClass); |
1258 if (compiler.serialization.isDeserialized(targetConstructor)) { | 1255 if (compiler.serialization.isDeserialized(targetConstructor)) { |
1259 List<ConstantExpression> arguments = | 1256 List<ConstantExpression> arguments = |
1260 compiledArguments.map((c) => c.expression).toList(); | 1257 compiledArguments.map((c) => c.expression).toList(); |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1446 class _CompilerEnvironment implements Environment { | 1443 class _CompilerEnvironment implements Environment { |
1447 final Compiler compiler; | 1444 final Compiler compiler; |
1448 | 1445 |
1449 _CompilerEnvironment(this.compiler); | 1446 _CompilerEnvironment(this.compiler); |
1450 | 1447 |
1451 @override | 1448 @override |
1452 String readFromEnvironment(String name) { | 1449 String readFromEnvironment(String name) { |
1453 return compiler.fromEnvironment(name); | 1450 return compiler.fromEnvironment(name); |
1454 } | 1451 } |
1455 } | 1452 } |
OLD | NEW |