| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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.constants.evaluation; | 5 library dart2js.constants.evaluation; |
| 6 | 6 |
| 7 import '../compiler.dart' show Compiler; | 7 import '../common/backend_api.dart' show BackendClasses; |
| 8 import '../elements/elements.dart'; | 8 import '../core_types.dart' show CommonElements; |
| 9 import '../elements/entities.dart'; | 9 import '../elements/entities.dart'; |
| 10 import '../elements/resolution_types.dart'; | |
| 11 import '../elements/types.dart'; | 10 import '../elements/types.dart'; |
| 12 import '../universe/call_structure.dart' show CallStructure; | 11 import '../universe/call_structure.dart' show CallStructure; |
| 13 import 'constructors.dart'; | 12 import 'constructors.dart'; |
| 14 import 'expressions.dart'; | 13 import 'expressions.dart'; |
| 15 | 14 |
| 16 /// Environment used for evaluating constant expressions. | 15 /// Environment used for evaluating constant expressions. |
| 17 abstract class Environment { | 16 abstract class Environment { |
| 18 // TODO(johnniwinther): Replace this with [CommonElements] and maybe | 17 // TODO(johnniwinther): Replace this with [CommonElements] and maybe |
| 19 // [Backend]. | 18 // [Backend]. |
| 20 Compiler get compiler; | 19 CommonElements get commonElements; |
| 20 |
| 21 BackendClasses get backendClasses; |
| 21 | 22 |
| 22 /// Read environments string passed in using the '-Dname=value' option. | 23 /// Read environments string passed in using the '-Dname=value' option. |
| 23 String readFromEnvironment(String name); | 24 String readFromEnvironment(String name); |
| 24 | 25 |
| 25 /// Returns the [ConstantExpression] for the value of the constant [local]. | 26 /// Returns the [ConstantExpression] for the value of the constant [local]. |
| 26 ConstantExpression getLocalConstant(Local local); | 27 ConstantExpression getLocalConstant(Local local); |
| 27 | 28 |
| 28 /// Returns the [ConstantExpression] for the value of the constant [field]. | 29 /// Returns the [ConstantExpression] for the value of the constant [field]. |
| 29 ConstantExpression getFieldConstant(FieldEntity field); | 30 ConstantExpression getFieldConstant(FieldEntity field); |
| 30 | 31 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 58 | 59 |
| 59 /// Returns the normalized [index]th positional argument. | 60 /// Returns the normalized [index]th positional argument. |
| 60 ConstantExpression getPositionalArgument(int index) { | 61 ConstantExpression getPositionalArgument(int index) { |
| 61 if (index >= callStructure.positionalArgumentCount) { | 62 if (index >= callStructure.positionalArgumentCount) { |
| 62 // The positional argument is not provided. | 63 // The positional argument is not provided. |
| 63 return defaultValues[index]; | 64 return defaultValues[index]; |
| 64 } | 65 } |
| 65 return arguments[index]; | 66 return arguments[index]; |
| 66 } | 67 } |
| 67 } | 68 } |
| OLD | NEW |