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 '../common/backend_api.dart' show BackendClasses; | |
8 import '../common_elements.dart' show CommonElements; | 7 import '../common_elements.dart' show CommonElements; |
9 import '../elements/resolution_types.dart' show DartTypes; | 8 import '../elements/resolution_types.dart' show DartTypes; |
10 import '../elements/types.dart'; | 9 import '../elements/types.dart'; |
11 import '../resolution/operators.dart'; | 10 import '../resolution/operators.dart'; |
12 import '../tree/dartstring.dart' show DartString; | 11 import '../tree/dartstring.dart' show DartString; |
13 import 'values.dart'; | 12 import 'values.dart'; |
14 | 13 |
15 abstract class Operation { | 14 abstract class Operation { |
16 String get name; | 15 String get name; |
17 } | 16 } |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 UnaryOperation get round; | 59 UnaryOperation get round; |
61 | 60 |
62 const ConstantSystem(); | 61 const ConstantSystem(); |
63 | 62 |
64 ConstantValue createInt(int i); | 63 ConstantValue createInt(int i); |
65 ConstantValue createDouble(double d); | 64 ConstantValue createDouble(double d); |
66 ConstantValue createString(DartString string); | 65 ConstantValue createString(DartString string); |
67 ConstantValue createBool(bool value); | 66 ConstantValue createBool(bool value); |
68 ConstantValue createNull(); | 67 ConstantValue createNull(); |
69 ConstantValue createList(InterfaceType type, List<ConstantValue> values); | 68 ConstantValue createList(InterfaceType type, List<ConstantValue> values); |
70 ConstantValue createMap( | 69 ConstantValue createMap(CommonElements commonElements, InterfaceType type, |
71 CommonElements commonElements, | 70 List<ConstantValue> keys, List<ConstantValue> values); |
72 BackendClasses backendClasses, | 71 ConstantValue createType(CommonElements commonElements, DartType type); |
73 InterfaceType type, | 72 ConstantValue createSymbol(CommonElements commonElements, String text); |
74 List<ConstantValue> keys, | |
75 List<ConstantValue> values); | |
76 ConstantValue createType(CommonElements commonElements, | |
77 BackendClasses backendClasses, DartType type); | |
78 ConstantValue createSymbol(CommonElements commonElements, | |
79 BackendClasses backendClasses, String text); | |
80 | 73 |
81 // We need to special case the subtype check for JavaScript constant | 74 // We need to special case the subtype check for JavaScript constant |
82 // system because an int is a double at runtime. | 75 // system because an int is a double at runtime. |
83 bool isSubtype(DartTypes types, DartType s, DartType t); | 76 bool isSubtype(DartTypes types, DartType s, DartType t); |
84 | 77 |
85 /** Returns true if the [constant] is an integer at runtime. */ | 78 /** Returns true if the [constant] is an integer at runtime. */ |
86 bool isInt(ConstantValue constant); | 79 bool isInt(ConstantValue constant); |
87 /** Returns true if the [constant] is a double at runtime. */ | 80 /** Returns true if the [constant] is a double at runtime. */ |
88 bool isDouble(ConstantValue constant); | 81 bool isDouble(ConstantValue constant); |
89 /** 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... |
144 return greaterEqual; | 137 return greaterEqual; |
145 case BinaryOperatorKind.EQ: | 138 case BinaryOperatorKind.EQ: |
146 return equal; | 139 return equal; |
147 case BinaryOperatorKind.IF_NULL: | 140 case BinaryOperatorKind.IF_NULL: |
148 return ifNull; | 141 return ifNull; |
149 default: | 142 default: |
150 return null; | 143 return null; |
151 } | 144 } |
152 } | 145 } |
153 } | 146 } |
OLD | NEW |