| 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 'constant_system_dart.dart'; | 7 import 'constant_system_dart.dart'; |
| 8 import 'constants/constant_system.dart'; | 8 import 'constants/constant_system.dart'; |
| 9 import 'constants/expressions.dart'; | 9 import 'constants/expressions.dart'; |
| 10 import 'constants/values.dart'; | 10 import 'constants/values.dart'; |
| (...skipping 901 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 912 ConstantCompilerBase handler, | 912 ConstantCompilerBase handler, |
| 913 Element context, | 913 Element context, |
| 914 Node node, | 914 Node node, |
| 915 InterfaceType type, | 915 InterfaceType type, |
| 916 ConstructorElement constructor, | 916 ConstructorElement constructor, |
| 917 InterfaceType constructedType, | 917 InterfaceType constructedType, |
| 918 ConstructorElement target, | 918 ConstructorElement target, |
| 919 CallStructure callStructure, | 919 CallStructure callStructure, |
| 920 List<AstConstant> concreteArguments, | 920 List<AstConstant> concreteArguments, |
| 921 List<AstConstant> normalizedArguments) { | 921 List<AstConstant> normalizedArguments) { |
| 922 assert(invariant(node, !target.isRedirectingFactory, | 922 if (target.isRedirectingFactory) { |
| 923 message: "makeConstructedConstant can only be called with the " | 923 // This happens is case of cyclic redirection. |
| 924 "effective target: $constructor")); | 924 assert(invariant(node, compiler.compilationFailed, |
| 925 message: "makeConstructedConstant can only be called with the " |
| 926 "effective target: $constructor")); |
| 927 return new AstConstant( |
| 928 context, node, new ErroneousConstantExpression()); |
| 929 } |
| 925 assert(invariant(node, callStructure.signatureApplies(constructor) || | 930 assert(invariant(node, callStructure.signatureApplies(constructor) || |
| 926 compiler.compilationFailed, | 931 compiler.compilationFailed, |
| 927 message: "Call structure $callStructure does not apply to constructor " | 932 message: "Call structure $callStructure does not apply to constructor " |
| 928 "$constructor.")); | 933 "$constructor.")); |
| 929 | 934 |
| 930 ConstructorEvaluator evaluator = new ConstructorEvaluator( | 935 ConstructorEvaluator evaluator = new ConstructorEvaluator( |
| 931 constructedType, target, handler, compiler); | 936 constructedType, target, handler, compiler); |
| 932 evaluator.evaluateConstructorFieldValues(normalizedArguments); | 937 evaluator.evaluateConstructorFieldValues(normalizedArguments); |
| 933 Map<FieldElement, AstConstant> fieldConstants = | 938 Map<FieldElement, AstConstant> fieldConstants = |
| 934 evaluator.buildFieldConstants(target.enclosingClass); | 939 evaluator.buildFieldConstants(target.enclosingClass); |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1206 ConstantValue get value => expression.value; | 1211 ConstantValue get value => expression.value; |
| 1207 | 1212 |
| 1208 String toString() => expression.toString(); | 1213 String toString() => expression.toString(); |
| 1209 } | 1214 } |
| 1210 | 1215 |
| 1211 /// A synthetic constant used to recover from errors. | 1216 /// A synthetic constant used to recover from errors. |
| 1212 class ErroneousAstConstant extends AstConstant { | 1217 class ErroneousAstConstant extends AstConstant { |
| 1213 ErroneousAstConstant(Element element, Node node) | 1218 ErroneousAstConstant(Element element, Node node) |
| 1214 : super(element, node, new ErroneousConstantExpression()); | 1219 : super(element, node, new ErroneousConstantExpression()); |
| 1215 } | 1220 } |
| OLD | NEW |