| 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 '../common.dart'; | 7 import '../common.dart'; |
| 8 import '../common_elements.dart' show CommonElements; | 8 import '../common_elements.dart' show CommonElements; |
| 9 import '../elements/entities.dart'; | 9 import '../elements/entities.dart'; |
| 10 import '../elements/types.dart'; | 10 import '../elements/types.dart'; |
| 11 import '../universe/call_structure.dart' show CallStructure; | 11 import '../universe/call_structure.dart' show CallStructure; |
| 12 import 'constructors.dart'; | 12 import 'constructors.dart'; |
| 13 import 'expressions.dart'; | 13 import 'expressions.dart'; |
| 14 | 14 |
| 15 /// Environment used for evaluating constant expressions. | 15 /// Environment used for evaluating constant expressions. |
| 16 abstract class EvaluationEnvironment { | 16 abstract class EvaluationEnvironment { |
| 17 CommonElements get commonElements; | 17 CommonElements get commonElements; |
| 18 | 18 |
| 19 /// Read environments string passed in using the '-Dname=value' option. | 19 /// Read environments string passed in using the '-Dname=value' option. |
| 20 String readFromEnvironment(String name); | 20 String readFromEnvironment(String name); |
| 21 | 21 |
| 22 /// Returns the [ConstantExpression] for the value of the constant [local]. | 22 /// Returns the [ConstantExpression] for the value of the constant [local]. |
| 23 ConstantExpression getLocalConstant(Local local); | 23 ConstantExpression getLocalConstant(covariant Local local); |
| 24 | 24 |
| 25 /// Returns the [ConstantExpression] for the value of the constant [field]. | 25 /// Returns the [ConstantExpression] for the value of the constant [field]. |
| 26 ConstantExpression getFieldConstant(FieldEntity field); | 26 ConstantExpression getFieldConstant(covariant FieldEntity field); |
| 27 | 27 |
| 28 /// Returns the [ConstantConstructor] corresponding to the constant | 28 /// Returns the [ConstantConstructor] corresponding to the constant |
| 29 /// [constructor]. | 29 /// [constructor]. |
| 30 ConstantConstructor getConstructorConstant(ConstructorEntity constructor); | 30 ConstantConstructor getConstructorConstant( |
| 31 covariant ConstructorEntity constructor); |
| 31 | 32 |
| 32 /// Performs the substitution of the type arguments of [target] for their | 33 /// Performs the substitution of the type arguments of [target] for their |
| 33 /// corresponding type variables in [type]. | 34 /// corresponding type variables in [type]. |
| 34 InterfaceType substByContext(InterfaceType base, InterfaceType target); | 35 InterfaceType substByContext( |
| 36 covariant InterfaceType base, covariant InterfaceType target); |
| 35 } | 37 } |
| 36 | 38 |
| 37 /// The normalized arguments passed to a const constructor computed from the | 39 /// The normalized arguments passed to a const constructor computed from the |
| 38 /// actual [arguments] and the [defaultValues] of the called construrctor. | 40 /// actual [arguments] and the [defaultValues] of the called construrctor. |
| 39 class NormalizedArguments { | 41 class NormalizedArguments { |
| 40 final Map<dynamic /*int|String*/, ConstantExpression> defaultValues; | 42 final Map<dynamic /*int|String*/, ConstantExpression> defaultValues; |
| 41 final CallStructure callStructure; | 43 final CallStructure callStructure; |
| 42 final List<ConstantExpression> arguments; | 44 final List<ConstantExpression> arguments; |
| 43 | 45 |
| 44 NormalizedArguments(this.defaultValues, this.callStructure, this.arguments); | 46 NormalizedArguments(this.defaultValues, this.callStructure, this.arguments); |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 if (needsComma) { | 110 if (needsComma) { |
| 109 sb.write(','); | 111 sb.write(','); |
| 110 } | 112 } |
| 111 sb.write(value.toStructuredText()); | 113 sb.write(value.toStructuredText()); |
| 112 needsComma = true; | 114 needsComma = true; |
| 113 }); | 115 }); |
| 114 sb.write(']]'); | 116 sb.write(']]'); |
| 115 return sb.toString(); | 117 return sb.toString(); |
| 116 } | 118 } |
| 117 } | 119 } |
| OLD | NEW |