| 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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 int visitInterceptor(InterceptorConstantValue a, InterceptorConstantValue b) { | 141 int visitInterceptor(InterceptorConstantValue a, InterceptorConstantValue b) { |
| 142 return compareDartTypes(a.dispatchedType, b.dispatchedType); | 142 return compareDartTypes(a.dispatchedType, b.dispatchedType); |
| 143 } | 143 } |
| 144 | 144 |
| 145 int visitSynthetic(SyntheticConstantValue a, SyntheticConstantValue b) { | 145 int visitSynthetic(SyntheticConstantValue a, SyntheticConstantValue b) { |
| 146 // [SyntheticConstantValue]s have abstract fields that are set only by | 146 // [SyntheticConstantValue]s have abstract fields that are set only by |
| 147 // convention. Lucky for us, they do not occur as top level constant, only | 147 // convention. Lucky for us, they do not occur as top level constant, only |
| 148 // as elements of a few constants. If this becomes a source of instability, | 148 // as elements of a few constants. If this becomes a source of instability, |
| 149 // we will need to add a total ordering on JavaScript ASTs including | 149 // we will need to add a total ordering on JavaScript ASTs including |
| 150 // deferred elements. | 150 // deferred elements. |
| 151 SyntheticConstantKind aKind = a.kind; | 151 SyntheticConstantKind aKind = a.valueKind; |
| 152 SyntheticConstantKind bKind = b.kind; | 152 SyntheticConstantKind bKind = b.valueKind; |
| 153 int r = aKind.index - bKind.index; | 153 int r = aKind.index - bKind.index; |
| 154 if (r != 0) return r; | 154 if (r != 0) return r; |
| 155 switch (a.kind) { | 155 switch (aKind) { |
| 156 case SyntheticConstantKind.DUMMY_INTERCEPTOR: | 156 case SyntheticConstantKind.DUMMY_INTERCEPTOR: |
| 157 case SyntheticConstantKind.EMPTY_VALUE: | 157 case SyntheticConstantKind.EMPTY_VALUE: |
| 158 // Never emitted. | 158 // Never emitted. |
| 159 return 0; | 159 return 0; |
| 160 | 160 |
| 161 case SyntheticConstantKind.TYPEVARIABLE_REFERENCE: | 161 case SyntheticConstantKind.TYPEVARIABLE_REFERENCE: |
| 162 // An opaque deferred JS AST reference to a type in reflection data. | 162 // An opaque deferred JS AST reference to a type in reflection data. |
| 163 return 0; | 163 return 0; |
| 164 case SyntheticConstantKind.NAME: | 164 case SyntheticConstantKind.NAME: |
| 165 // An opaque deferred JS AST reference to a name. | 165 // An opaque deferred JS AST reference to a name. |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 int visitBool(BoolConstantValue a, _) => BOOL; | 206 int visitBool(BoolConstantValue a, _) => BOOL; |
| 207 int visitString(StringConstantValue a, _) => STRING; | 207 int visitString(StringConstantValue a, _) => STRING; |
| 208 int visitList(ListConstantValue a, _) => LIST; | 208 int visitList(ListConstantValue a, _) => LIST; |
| 209 int visitMap(MapConstantValue a, _) => MAP; | 209 int visitMap(MapConstantValue a, _) => MAP; |
| 210 int visitConstructed(ConstructedConstantValue a, _) => CONSTRUCTED; | 210 int visitConstructed(ConstructedConstantValue a, _) => CONSTRUCTED; |
| 211 int visitType(TypeConstantValue a, _) => TYPE; | 211 int visitType(TypeConstantValue a, _) => TYPE; |
| 212 int visitInterceptor(InterceptorConstantValue a, _) => INTERCEPTOR; | 212 int visitInterceptor(InterceptorConstantValue a, _) => INTERCEPTOR; |
| 213 int visitSynthetic(SyntheticConstantValue a, _) => SYNTHETIC; | 213 int visitSynthetic(SyntheticConstantValue a, _) => SYNTHETIC; |
| 214 int visitDeferred(DeferredConstantValue a, _) => DEFERRED; | 214 int visitDeferred(DeferredConstantValue a, _) => DEFERRED; |
| 215 } | 215 } |
| OLD | NEW |