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