| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 js_backend.serialization; | 5 library js_backend.serialization; |
| 6 | 6 |
| 7 import '../common/backend_api.dart' show BackendSerialization; | 7 import '../common/backend_api.dart' show BackendSerialization; |
| 8 import '../elements/elements.dart'; |
| 8 import '../elements/resolution_types.dart'; | 9 import '../elements/resolution_types.dart'; |
| 9 import '../elements/elements.dart'; | 10 import '../elements/types.dart'; |
| 10 import '../js/js.dart' as js; | 11 import '../js/js.dart' as js; |
| 11 import '../native/native.dart'; | 12 import '../native/native.dart'; |
| 12 import '../serialization/keys.dart'; | 13 import '../serialization/keys.dart'; |
| 13 import '../serialization/serialization.dart' | 14 import '../serialization/serialization.dart' |
| 14 show DeserializerPlugin, ObjectDecoder, ObjectEncoder, SerializerPlugin; | 15 show DeserializerPlugin, ObjectDecoder, ObjectEncoder, SerializerPlugin; |
| 15 import '../universe/side_effects.dart'; | 16 import '../universe/side_effects.dart'; |
| 16 import 'js_backend.dart'; | 17 import 'js_backend.dart'; |
| 17 | 18 |
| 18 const String _BACKEND_DATA_TAG = 'jsBackendData'; | 19 const String _BACKEND_DATA_TAG = 'jsBackendData'; |
| 19 const Key DART_TYPES_RETURNED = const Key('dartTypesReturned'); | 20 const Key DART_TYPES_RETURNED = const Key('dartTypesReturned'); |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 return NativeBehaviorSerialization.deserializeNativeBehavior(decoder); | 150 return NativeBehaviorSerialization.deserializeNativeBehavior(decoder); |
| 150 } | 151 } |
| 151 } | 152 } |
| 152 | 153 |
| 153 class NativeBehaviorSerialization { | 154 class NativeBehaviorSerialization { |
| 154 static const int NORMAL_TYPE = 0; | 155 static const int NORMAL_TYPE = 0; |
| 155 static const int THIS_TYPE = 1; | 156 static const int THIS_TYPE = 1; |
| 156 static const int SPECIAL_TYPE = 2; | 157 static const int SPECIAL_TYPE = 2; |
| 157 | 158 |
| 158 static int getTypeKind(var type) { | 159 static int getTypeKind(var type) { |
| 159 if (type is ResolutionDartType) { | 160 if (type is DartType) { |
| 160 // TODO(johnniwinther): Remove this when annotation are no longer resolved | 161 // TODO(johnniwinther): Remove this when annotation are no longer resolved |
| 161 // to this-types. | 162 // to this-types. |
| 162 if (type is GenericType && | 163 if (type is GenericType && |
| 163 type.isGeneric && | 164 type.isGeneric && |
| 164 type == type.element.thisType) { | 165 type == type.element.thisType) { |
| 165 return THIS_TYPE; | 166 return THIS_TYPE; |
| 166 } | 167 } |
| 167 return NORMAL_TYPE; | 168 return NORMAL_TYPE; |
| 168 } | 169 } |
| 169 return SPECIAL_TYPE; | 170 return SPECIAL_TYPE; |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 behavior.codeTemplate = js.js.parseForeignJS(behavior.codeTemplateText); | 250 behavior.codeTemplate = js.js.parseForeignJS(behavior.codeTemplateText); |
| 250 } | 251 } |
| 251 | 252 |
| 252 behavior.throwBehavior = | 253 behavior.throwBehavior = |
| 253 decoder.getEnum(THROW_BEHAVIOR, NativeThrowBehavior.values); | 254 decoder.getEnum(THROW_BEHAVIOR, NativeThrowBehavior.values); |
| 254 behavior.isAllocation = decoder.getBool(IS_ALLOCATION); | 255 behavior.isAllocation = decoder.getBool(IS_ALLOCATION); |
| 255 behavior.useGvn = decoder.getBool(USE_GVN); | 256 behavior.useGvn = decoder.getBool(USE_GVN); |
| 256 return behavior; | 257 return behavior; |
| 257 } | 258 } |
| 258 } | 259 } |
| OLD | NEW |