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.js_emitter.constant_ordering; | 5 library dart2js.js_emitter.constant_ordering; |
6 | 6 |
7 import '../constants/values.dart'; | 7 import '../constants/values.dart'; |
8 | 8 |
9 import '../dart_types.dart'; | 9 import '../dart_types.dart'; |
10 import '../elements/elements.dart' show Element, Elements, FieldElement; | 10 import '../elements/elements.dart' show Element, Elements, FieldElement; |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 } | 69 } |
70 | 70 |
71 int visitFunction(FunctionConstantValue a, FunctionConstantValue b) { | 71 int visitFunction(FunctionConstantValue a, FunctionConstantValue b) { |
72 return compareElements(a.element, b.element); | 72 return compareElements(a.element, b.element); |
73 } | 73 } |
74 | 74 |
75 int visitNull(NullConstantValue a, NullConstantValue b) { | 75 int visitNull(NullConstantValue a, NullConstantValue b) { |
76 return 0; | 76 return 0; |
77 } | 77 } |
78 | 78 |
| 79 int visitNonConstant(NonConstantValue a, NonConstantValue b) { |
| 80 return 0; |
| 81 } |
| 82 |
79 int visitInt(IntConstantValue a, IntConstantValue b) { | 83 int visitInt(IntConstantValue a, IntConstantValue b) { |
80 return a.primitiveValue.compareTo(b.primitiveValue); | 84 return a.primitiveValue.compareTo(b.primitiveValue); |
81 } | 85 } |
82 | 86 |
83 int visitDouble(DoubleConstantValue a, DoubleConstantValue b) { | 87 int visitDouble(DoubleConstantValue a, DoubleConstantValue b) { |
84 return a.primitiveValue.compareTo(b.primitiveValue); | 88 return a.primitiveValue.compareTo(b.primitiveValue); |
85 } | 89 } |
86 | 90 |
87 int visitBool(BoolConstantValue a, BoolConstantValue b) { | 91 int visitBool(BoolConstantValue a, BoolConstantValue b) { |
88 int aInt = a.primitiveValue ? 1 : 0; | 92 int aInt = a.primitiveValue ? 1 : 0; |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 static const int DOUBLE = 4; | 186 static const int DOUBLE = 4; |
183 static const int BOOL = 5; | 187 static const int BOOL = 5; |
184 static const int STRING = 6; | 188 static const int STRING = 6; |
185 static const int LIST = 7; | 189 static const int LIST = 7; |
186 static const int MAP = 8; | 190 static const int MAP = 8; |
187 static const int CONSTRUCTED = 9; | 191 static const int CONSTRUCTED = 9; |
188 static const int TYPE = 10; | 192 static const int TYPE = 10; |
189 static const int INTERCEPTOR = 11; | 193 static const int INTERCEPTOR = 11; |
190 static const int SYNTHETIC = 12; | 194 static const int SYNTHETIC = 12; |
191 static const int DEFERRED = 13; | 195 static const int DEFERRED = 13; |
| 196 static const int NONCONSTANT = 13; |
192 | 197 |
193 static int kind(ConstantValue constant) => | 198 static int kind(ConstantValue constant) => |
194 constant.accept(const _KindVisitor(), null); | 199 constant.accept(const _KindVisitor(), null); |
195 | 200 |
196 int visitFunction(FunctionConstantValue a, _) => FUNCTION; | 201 int visitFunction(FunctionConstantValue a, _) => FUNCTION; |
197 int visitNull(NullConstantValue a, _) => NULL; | 202 int visitNull(NullConstantValue a, _) => NULL; |
| 203 int visitNonConstant(NonConstantValue a, _) => NONCONSTANT; |
198 int visitInt(IntConstantValue a, _) => INT; | 204 int visitInt(IntConstantValue a, _) => INT; |
199 int visitDouble(DoubleConstantValue a, _) => DOUBLE; | 205 int visitDouble(DoubleConstantValue a, _) => DOUBLE; |
200 int visitBool(BoolConstantValue a, _) => BOOL; | 206 int visitBool(BoolConstantValue a, _) => BOOL; |
201 int visitString(StringConstantValue a, _) => STRING; | 207 int visitString(StringConstantValue a, _) => STRING; |
202 int visitList(ListConstantValue a, _) => LIST; | 208 int visitList(ListConstantValue a, _) => LIST; |
203 int visitMap(MapConstantValue a, _) => MAP; | 209 int visitMap(MapConstantValue a, _) => MAP; |
204 int visitConstructed(ConstructedConstantValue a, _) => CONSTRUCTED; | 210 int visitConstructed(ConstructedConstantValue a, _) => CONSTRUCTED; |
205 int visitType(TypeConstantValue a, _) => TYPE; | 211 int visitType(TypeConstantValue a, _) => TYPE; |
206 int visitInterceptor(InterceptorConstantValue a, _) => INTERCEPTOR; | 212 int visitInterceptor(InterceptorConstantValue a, _) => INTERCEPTOR; |
207 int visitSynthetic(SyntheticConstantValue a, _) => SYNTHETIC; | 213 int visitSynthetic(SyntheticConstantValue a, _) => SYNTHETIC; |
208 int visitDeferred(DeferredConstantValue a, _) => DEFERRED; | 214 int visitDeferred(DeferredConstantValue a, _) => DEFERRED; |
209 } | 215 } |
OLD | NEW |