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/elements.dart'; |
9 import '../elements/resolution_types.dart'; | 9 import '../elements/resolution_types.dart'; |
10 import '../elements/types.dart'; | 10 import '../elements/types.dart'; |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 | 259 |
260 static NativeBehavior deserializeNativeBehavior(ObjectDecoder decoder) { | 260 static NativeBehavior deserializeNativeBehavior(ObjectDecoder decoder) { |
261 SideEffects sideEffects = | 261 SideEffects sideEffects = |
262 new SideEffects.fromFlags(decoder.getInt(SIDE_EFFECTS)); | 262 new SideEffects.fromFlags(decoder.getInt(SIDE_EFFECTS)); |
263 NativeBehavior behavior = new NativeBehavior.internal(sideEffects); | 263 NativeBehavior behavior = new NativeBehavior.internal(sideEffects); |
264 | 264 |
265 behavior.typesReturned | 265 behavior.typesReturned |
266 .addAll(decoder.getTypes(DART_TYPES_RETURNED, isOptional: true)); | 266 .addAll(decoder.getTypes(DART_TYPES_RETURNED, isOptional: true)); |
267 behavior.typesReturned.addAll(decoder | 267 behavior.typesReturned.addAll(decoder |
268 .getElements(THIS_TYPES_RETURNED, isOptional: true) | 268 .getElements(THIS_TYPES_RETURNED, isOptional: true) |
269 .map((element) => element.thisType) | 269 .map((dynamic element) => element.thisType) |
270 .toList()); | 270 .toList()); |
271 behavior.typesReturned.addAll(decoder | 271 behavior.typesReturned.addAll(decoder |
272 .getStrings(SPECIAL_TYPES_RETURNED, isOptional: true) | 272 .getStrings(SPECIAL_TYPES_RETURNED, isOptional: true) |
273 .map(SpecialType.fromName)); | 273 .map(SpecialType.fromName)); |
274 | 274 |
275 behavior.typesInstantiated | 275 behavior.typesInstantiated |
276 .addAll(decoder.getTypes(DART_TYPES_INSTANTIATED, isOptional: true)); | 276 .addAll(decoder.getTypes(DART_TYPES_INSTANTIATED, isOptional: true)); |
277 behavior.typesInstantiated.addAll(decoder | 277 behavior.typesInstantiated.addAll(decoder |
278 .getElements(THIS_TYPES_INSTANTIATED, isOptional: true) | 278 .getElements(THIS_TYPES_INSTANTIATED, isOptional: true) |
279 .map((element) => element.thisType) | 279 .map((dynamic element) => element.thisType) |
280 .toList()); | 280 .toList()); |
281 behavior.typesInstantiated.addAll(decoder | 281 behavior.typesInstantiated.addAll(decoder |
282 .getStrings(SPECIAL_TYPES_INSTANTIATED, isOptional: true) | 282 .getStrings(SPECIAL_TYPES_INSTANTIATED, isOptional: true) |
283 .map(SpecialType.fromName)); | 283 .map(SpecialType.fromName)); |
284 | 284 |
285 behavior.codeTemplateText = | 285 behavior.codeTemplateText = |
286 decoder.getString(CODE_TEMPLATE, isOptional: true); | 286 decoder.getString(CODE_TEMPLATE, isOptional: true); |
287 if (behavior.codeTemplateText != null) { | 287 if (behavior.codeTemplateText != null) { |
288 behavior.codeTemplate = js.js.parseForeignJS(behavior.codeTemplateText); | 288 behavior.codeTemplate = js.js.parseForeignJS(behavior.codeTemplateText); |
289 } | 289 } |
290 | 290 |
291 behavior.throwBehavior = | 291 behavior.throwBehavior = |
292 decoder.getEnum(THROW_BEHAVIOR, NativeThrowBehavior.values); | 292 decoder.getEnum(THROW_BEHAVIOR, NativeThrowBehavior.values); |
293 behavior.isAllocation = decoder.getBool(IS_ALLOCATION); | 293 behavior.isAllocation = decoder.getBool(IS_ALLOCATION); |
294 behavior.useGvn = decoder.getBool(USE_GVN); | 294 behavior.useGvn = decoder.getBool(USE_GVN); |
295 return behavior; | 295 return behavior; |
296 } | 296 } |
297 } | 297 } |
OLD | NEW |