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 import '../elements/elements.dart' show Elements; | 8 import '../elements/elements.dart' show Elements; |
9 import '../elements/entities.dart' show Entity, FieldEntity; | 9 import '../elements/entities.dart' show Entity, FieldEntity; |
10 import '../elements/resolution_types.dart'; | 10 import '../elements/resolution_types.dart'; |
11 import '../js_backend/js_backend.dart' show SyntheticConstantKind; | 11 import '../js_backend/js_backend.dart' show SyntheticConstantKind; |
12 import '../tree/dartstring.dart' show DartString; | 12 import '../tree/dartstring.dart' show DartString; |
13 | 13 |
14 /// A canonical but arbrary ordering of constants. The ordering is 'stable' | 14 /// A canonical but arbitrary ordering of constants. The ordering is 'stable' |
15 /// under perturbation of the source. | 15 /// under perturbation of the source. |
16 int deepCompareConstants(ConstantValue a, ConstantValue b) { | 16 int deepCompareConstants(ConstantValue a, ConstantValue b) { |
17 return _CompareVisitor.compareValues(a, b); | 17 return _CompareVisitor.compareValues(a, b); |
18 } | 18 } |
19 | 19 |
20 class _CompareVisitor implements ConstantValueVisitor<int, ConstantValue> { | 20 class _CompareVisitor implements ConstantValueVisitor<int, ConstantValue> { |
21 const _CompareVisitor(); | 21 const _CompareVisitor(); |
22 | 22 |
23 static int compareValues(ConstantValue a, ConstantValue b) { | 23 static int compareValues(ConstantValue a, ConstantValue b) { |
24 if (identical(a, b)) return 0; | 24 if (identical(a, b)) return 0; |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 int visitBool(BoolConstantValue a, _) => BOOL; | 214 int visitBool(BoolConstantValue a, _) => BOOL; |
215 int visitString(StringConstantValue a, _) => STRING; | 215 int visitString(StringConstantValue a, _) => STRING; |
216 int visitList(ListConstantValue a, _) => LIST; | 216 int visitList(ListConstantValue a, _) => LIST; |
217 int visitMap(MapConstantValue a, _) => MAP; | 217 int visitMap(MapConstantValue a, _) => MAP; |
218 int visitConstructed(ConstructedConstantValue a, _) => CONSTRUCTED; | 218 int visitConstructed(ConstructedConstantValue a, _) => CONSTRUCTED; |
219 int visitType(TypeConstantValue a, _) => TYPE; | 219 int visitType(TypeConstantValue a, _) => TYPE; |
220 int visitInterceptor(InterceptorConstantValue a, _) => INTERCEPTOR; | 220 int visitInterceptor(InterceptorConstantValue a, _) => INTERCEPTOR; |
221 int visitSynthetic(SyntheticConstantValue a, _) => SYNTHETIC; | 221 int visitSynthetic(SyntheticConstantValue a, _) => SYNTHETIC; |
222 int visitDeferred(DeferredConstantValue a, _) => DEFERRED; | 222 int visitDeferred(DeferredConstantValue a, _) => DEFERRED; |
223 } | 223 } |
OLD | NEW |