| 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 part of dart2js; | 5 library dart2js.compile_time_constant_evaluator; |
| 6 |
| 7 import 'constant_system_dart.dart'; |
| 8 import 'constants/constant_system.dart'; |
| 9 import 'constants/expressions.dart'; |
| 10 import 'constants/values.dart'; |
| 11 import 'dart_types.dart'; |
| 12 import 'dart2jslib.dart' show Compiler, CompilerTask, MessageKind, invariant; |
| 13 import 'elements/elements.dart'; |
| 14 import 'elements/modelx.dart' show FunctionElementX; |
| 15 import 'resolution/resolution.dart'; |
| 16 import 'tree/tree.dart'; |
| 17 import 'util/util.dart' show Link; |
| 18 import 'universe/universe.dart' show CallStructure; |
| 6 | 19 |
| 7 /// A [ConstantEnvironment] provides access for constants compiled for variable | 20 /// A [ConstantEnvironment] provides access for constants compiled for variable |
| 8 /// initializers. | 21 /// initializers. |
| 9 abstract class ConstantEnvironment { | 22 abstract class ConstantEnvironment { |
| 10 /// Returns the constant for the initializer of [element]. | 23 /// Returns the constant for the initializer of [element]. |
| 11 ConstantExpression getConstantForVariable(VariableElement element); | 24 ConstantExpression getConstantForVariable(VariableElement element); |
| 12 } | 25 } |
| 13 | 26 |
| 14 /// A class that can compile and provide constants for variables, nodes and | 27 /// A class that can compile and provide constants for variables, nodes and |
| 15 /// metadata. | 28 /// metadata. |
| (...skipping 1103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1119 ConstantValue get value => expression.value; | 1132 ConstantValue get value => expression.value; |
| 1120 | 1133 |
| 1121 String toString() => expression.toString(); | 1134 String toString() => expression.toString(); |
| 1122 } | 1135 } |
| 1123 | 1136 |
| 1124 /// A synthetic constant used to recover from errors. | 1137 /// A synthetic constant used to recover from errors. |
| 1125 class ErroneousAstConstant extends AstConstant { | 1138 class ErroneousAstConstant extends AstConstant { |
| 1126 ErroneousAstConstant(Element element, Node node) | 1139 ErroneousAstConstant(Element element, Node node) |
| 1127 : super(element, node, new ErroneousConstantExpression()); | 1140 : super(element, node, new ErroneousConstantExpression()); |
| 1128 } | 1141 } |
| OLD | NEW |