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 dart2js.serialization.resolved_ast; | 5 library dart2js.serialization.resolved_ast; |
6 | 6 |
7 import '../common.dart'; | 7 import '../common.dart'; |
8 import '../common/resolution.dart'; | 8 import '../common/resolution.dart'; |
9 import '../constants/expressions.dart'; | 9 import '../constants/expressions.dart'; |
10 import '../dart_types.dart'; | 10 import '../dart_types.dart'; |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 | 93 |
94 /// Serializes [resolvedAst] into [objectEncoder]. | 94 /// Serializes [resolvedAst] into [objectEncoder]. |
95 void serialize() { | 95 void serialize() { |
96 objectEncoder.setEnum(Key.KIND, resolvedAst.kind); | 96 objectEncoder.setEnum(Key.KIND, resolvedAst.kind); |
97 switch (resolvedAst.kind) { | 97 switch (resolvedAst.kind) { |
98 case ResolvedAstKind.PARSED: | 98 case ResolvedAstKind.PARSED: |
99 serializeParsed(); | 99 serializeParsed(); |
100 break; | 100 break; |
101 case ResolvedAstKind.DEFAULT_CONSTRUCTOR: | 101 case ResolvedAstKind.DEFAULT_CONSTRUCTOR: |
102 case ResolvedAstKind.FORWARDING_CONSTRUCTOR: | 102 case ResolvedAstKind.FORWARDING_CONSTRUCTOR: |
| 103 case ResolvedAstKind.DEFERRED_LOAD_LIBRARY: |
103 // No additional properties. | 104 // No additional properties. |
104 break; | 105 break; |
105 } | 106 } |
106 } | 107 } |
107 | 108 |
108 /// Serialize [ResolvedAst] that is defined in terms of an AST together with | 109 /// Serialize [ResolvedAst] that is defined in terms of an AST together with |
109 /// [TreeElements]. | 110 /// [TreeElements]. |
110 void serializeParsed() { | 111 void serializeParsed() { |
111 objectEncoder.setUri(Key.URI, resolvedAst.sourceUri, resolvedAst.sourceUri); | 112 objectEncoder.setUri(Key.URI, resolvedAst.sourceUri, resolvedAst.sourceUri); |
112 AstKind kind; | 113 AstKind kind; |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
348 switch (kind) { | 349 switch (kind) { |
349 case ResolvedAstKind.PARSED: | 350 case ResolvedAstKind.PARSED: |
350 deserializeParsed(element, objectDecoder, parsing, getBeginToken, | 351 deserializeParsed(element, objectDecoder, parsing, getBeginToken, |
351 nativeDataDeserializer); | 352 nativeDataDeserializer); |
352 break; | 353 break; |
353 case ResolvedAstKind.DEFAULT_CONSTRUCTOR: | 354 case ResolvedAstKind.DEFAULT_CONSTRUCTOR: |
354 case ResolvedAstKind.FORWARDING_CONSTRUCTOR: | 355 case ResolvedAstKind.FORWARDING_CONSTRUCTOR: |
355 (element as AstElementMixinZ).resolvedAst = | 356 (element as AstElementMixinZ).resolvedAst = |
356 new SynthesizedResolvedAst(element, kind); | 357 new SynthesizedResolvedAst(element, kind); |
357 break; | 358 break; |
| 359 case ResolvedAstKind.DEFERRED_LOAD_LIBRARY: |
| 360 break; |
358 } | 361 } |
359 } | 362 } |
360 | 363 |
361 /// Deserialize the [ResolvedAst]s for the member [element] (constructor, | 364 /// Deserialize the [ResolvedAst]s for the member [element] (constructor, |
362 /// method, or field) and its nested closures. The [ResolvedAst]s are added | 365 /// method, or field) and its nested closures. The [ResolvedAst]s are added |
363 /// to [resolvedAstMap]. | 366 /// to [resolvedAstMap]. |
364 static void deserializeParsed( | 367 static void deserializeParsed( |
365 AstElementMixinZ element, | 368 AstElementMixinZ element, |
366 ObjectDecoder objectDecoder, | 369 ObjectDecoder objectDecoder, |
367 ParsingContext parsing, | 370 ParsingContext parsing, |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
680 } | 683 } |
681 } | 684 } |
682 } | 685 } |
683 element.resolvedAst = | 686 element.resolvedAst = |
684 new ParsedResolvedAst(element, root, body, elements, uri); | 687 new ParsedResolvedAst(element, root, body, elements, uri); |
685 } | 688 } |
686 } | 689 } |
687 | 690 |
688 const Key PARAMETER_NODE = const Key('parameter.node'); | 691 const Key PARAMETER_NODE = const Key('parameter.node'); |
689 const Key PARAMETER_INITIALIZER = const Key('parameter.initializer'); | 692 const Key PARAMETER_INITIALIZER = const Key('parameter.initializer'); |
OLD | NEW |