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.constant_system; | 5 library dart2js.constant_system; |
6 | 6 |
7 import '../dart_types.dart'; | 7 import '../dart_types.dart'; |
8 import '../compiler.dart' show Compiler; | 8 import '../compiler.dart' show Compiler; |
9 import '../resolution/operators.dart'; | 9 import '../resolution/operators.dart'; |
10 import '../tree/tree.dart' show DartString; | 10 import '../tree/tree.dart' show DartString; |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 ConstantValue createDouble(double d); | 61 ConstantValue createDouble(double d); |
62 ConstantValue createString(DartString string); | 62 ConstantValue createString(DartString string); |
63 ConstantValue createBool(bool value); | 63 ConstantValue createBool(bool value); |
64 ConstantValue createNull(); | 64 ConstantValue createNull(); |
65 ConstantValue createList(InterfaceType type, List<ConstantValue> values); | 65 ConstantValue createList(InterfaceType type, List<ConstantValue> values); |
66 // TODO(johnniwinther): Remove the need for [compiler]. | 66 // TODO(johnniwinther): Remove the need for [compiler]. |
67 ConstantValue createMap(Compiler compiler, InterfaceType type, | 67 ConstantValue createMap(Compiler compiler, InterfaceType type, |
68 List<ConstantValue> keys, List<ConstantValue> values); | 68 List<ConstantValue> keys, List<ConstantValue> values); |
69 // TODO(johnniwinther): Remove the need for [compiler]. | 69 // TODO(johnniwinther): Remove the need for [compiler]. |
70 ConstantValue createType(Compiler compiler, DartType type); | 70 ConstantValue createType(Compiler compiler, DartType type); |
| 71 // TODO(johnniwinther): Remove the need for [compiler]. |
| 72 ConstantValue createSymbol(Compiler compiler, String text); |
71 | 73 |
72 // We need to special case the subtype check for JavaScript constant | 74 // We need to special case the subtype check for JavaScript constant |
73 // system because an int is a double at runtime. | 75 // system because an int is a double at runtime. |
74 bool isSubtype(DartTypes types, DartType s, DartType t); | 76 bool isSubtype(DartTypes types, DartType s, DartType t); |
75 | 77 |
76 /** Returns true if the [constant] is an integer at runtime. */ | 78 /** Returns true if the [constant] is an integer at runtime. */ |
77 bool isInt(ConstantValue constant); | 79 bool isInt(ConstantValue constant); |
78 /** Returns true if the [constant] is a double at runtime. */ | 80 /** Returns true if the [constant] is a double at runtime. */ |
79 bool isDouble(ConstantValue constant); | 81 bool isDouble(ConstantValue constant); |
80 /** Returns true if the [constant] is a string at runtime. */ | 82 /** Returns true if the [constant] is a string at runtime. */ |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 return greaterEqual; | 137 return greaterEqual; |
136 case BinaryOperatorKind.EQ: | 138 case BinaryOperatorKind.EQ: |
137 return equal; | 139 return equal; |
138 case BinaryOperatorKind.IF_NULL: | 140 case BinaryOperatorKind.IF_NULL: |
139 return ifNull; | 141 return ifNull; |
140 default: | 142 default: |
141 return null; | 143 return null; |
142 } | 144 } |
143 } | 145 } |
144 } | 146 } |
OLD | NEW |