| 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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 case ResolvedAstKind.DEFAULT_CONSTRUCTOR: | 101 case ResolvedAstKind.DEFAULT_CONSTRUCTOR: |
| 102 case ResolvedAstKind.FORWARDING_CONSTRUCTOR: | 102 case ResolvedAstKind.FORWARDING_CONSTRUCTOR: |
| 103 // No additional properties. | 103 // No additional properties. |
| 104 break; | 104 break; |
| 105 } | 105 } |
| 106 } | 106 } |
| 107 | 107 |
| 108 /// Serialize [ResolvedAst] that is defined in terms of an AST together with | 108 /// Serialize [ResolvedAst] that is defined in terms of an AST together with |
| 109 /// [TreeElements]. | 109 /// [TreeElements]. |
| 110 void serializeParsed() { | 110 void serializeParsed() { |
| 111 objectEncoder.setUri( | 111 objectEncoder.setUri(Key.URI, resolvedAst.sourceUri, resolvedAst.sourceUri); |
| 112 Key.URI, | |
| 113 elements.analyzedElement.compilationUnit.script.resourceUri, | |
| 114 elements.analyzedElement.compilationUnit.script.resourceUri); | |
| 115 AstKind kind; | 112 AstKind kind; |
| 116 if (element.enclosingClass is EnumClassElement) { | 113 if (element.enclosingClass is EnumClassElement) { |
| 117 if (element.name == 'index') { | 114 if (element.name == 'index') { |
| 118 kind = AstKind.ENUM_INDEX_FIELD; | 115 kind = AstKind.ENUM_INDEX_FIELD; |
| 119 } else if (element.name == 'values') { | 116 } else if (element.name == 'values') { |
| 120 kind = AstKind.ENUM_VALUES_FIELD; | 117 kind = AstKind.ENUM_VALUES_FIELD; |
| 121 } else if (element.name == 'toString') { | 118 } else if (element.name == 'toString') { |
| 122 kind = AstKind.ENUM_TO_STRING; | 119 kind = AstKind.ENUM_TO_STRING; |
| 123 } else if (element.isConstructor) { | 120 } else if (element.isConstructor) { |
| 124 kind = AstKind.ENUM_CONSTRUCTOR; | 121 kind = AstKind.ENUM_CONSTRUCTOR; |
| (...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 508 Token beginToken = readBeginToken(); | 505 Token beginToken = readBeginToken(); |
| 509 int getOrSetOffset = | 506 int getOrSetOffset = |
| 510 objectDecoder.getInt(Key.GET_OR_SET, isOptional: true); | 507 objectDecoder.getInt(Key.GET_OR_SET, isOptional: true); |
| 511 Token getOrSet; | 508 Token getOrSet; |
| 512 if (getOrSetOffset != null) { | 509 if (getOrSetOffset != null) { |
| 513 getOrSet = findTokenInStream(beginToken, getOrSetOffset); | 510 getOrSet = findTokenInStream(beginToken, getOrSetOffset); |
| 514 if (getOrSet == null) { | 511 if (getOrSet == null) { |
| 515 reporter.internalError( | 512 reporter.internalError( |
| 516 element, | 513 element, |
| 517 "No token found for $element in " | 514 "No token found for $element in " |
| 518 "${objectDecoder.getUri(Key.URI)} @ $getOrSetOffset"); | 515 "${uri} @ $getOrSetOffset"); |
| 519 } | 516 } |
| 520 } | 517 } |
| 521 return doParse((parser) { | 518 return doParse((parser) { |
| 522 parser.parseFunction(beginToken, getOrSet); | 519 parser.parseFunction(beginToken, getOrSet); |
| 523 }); | 520 }); |
| 524 } | 521 } |
| 525 } | 522 } |
| 526 | 523 |
| 527 AstKind kind = objectDecoder.getEnum(Key.SUB_KIND, AstKind.values); | 524 AstKind kind = objectDecoder.getEnum(Key.SUB_KIND, AstKind.values); |
| 528 Node root = computeNode(kind); | 525 Node root = computeNode(kind); |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 683 } | 680 } |
| 684 } | 681 } |
| 685 } | 682 } |
| 686 element.resolvedAst = | 683 element.resolvedAst = |
| 687 new ParsedResolvedAst(element, root, body, elements, uri); | 684 new ParsedResolvedAst(element, root, body, elements, uri); |
| 688 } | 685 } |
| 689 } | 686 } |
| 690 | 687 |
| 691 const Key PARAMETER_NODE = const Key('parameter.node'); | 688 const Key PARAMETER_NODE = const Key('parameter.node'); |
| 692 const Key PARAMETER_INITIALIZER = const Key('parameter.initializer'); | 689 const Key PARAMETER_INITIALIZER = const Key('parameter.initializer'); |
| OLD | NEW |