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/backend_api.dart' show BackendClasses; | |
9 import '../common_elements.dart' show CommonElements; | 8 import '../common_elements.dart' show CommonElements; |
10 import '../elements/entities.dart'; | 9 import '../elements/entities.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 | |
19 // [Backend]. | |
20 CommonElements get commonElements; | 17 CommonElements get commonElements; |
21 | 18 |
22 BackendClasses get backendClasses; | |
23 | |
24 /// Read environments string passed in using the '-Dname=value' option. | 19 /// Read environments string passed in using the '-Dname=value' option. |
25 String readFromEnvironment(String name); | 20 String readFromEnvironment(String name); |
26 | 21 |
27 /// Returns the [ConstantExpression] for the value of the constant [local]. | 22 /// Returns the [ConstantExpression] for the value of the constant [local]. |
28 ConstantExpression getLocalConstant(Local local); | 23 ConstantExpression getLocalConstant(Local local); |
29 | 24 |
30 /// Returns the [ConstantExpression] for the value of the constant [field]. | 25 /// Returns the [ConstantExpression] for the value of the constant [field]. |
31 ConstantExpression getFieldConstant(FieldEntity field); | 26 ConstantExpression getFieldConstant(FieldEntity field); |
32 | 27 |
33 /// Returns the [ConstantConstructor] corresponding to the constant | 28 /// Returns the [ConstantConstructor] corresponding to the constant |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 if (needsComma) { | 100 if (needsComma) { |
106 sb.write(','); | 101 sb.write(','); |
107 } | 102 } |
108 sb.write(value.toStructuredText()); | 103 sb.write(value.toStructuredText()); |
109 needsComma = true; | 104 needsComma = true; |
110 }); | 105 }); |
111 sb.write(']]'); | 106 sb.write(']]'); |
112 return sb.toString(); | 107 return sb.toString(); |
113 } | 108 } |
114 } | 109 } |
OLD | NEW |