Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(92)

Side by Side Diff: pkg/compiler/lib/src/serialization/resolved_ast_serialization.dart

Issue 2088233003: Serialize erroneous element and more (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
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(
112 Key.URI, 112 Key.URI, resolvedAst.sourceUri, resolvedAst.sourceUri);
113 elements.analyzedElement.compilationUnit.script.resourceUri,
114 elements.analyzedElement.compilationUnit.script.resourceUri);
115 AstKind kind; 113 AstKind kind;
116 if (element.enclosingClass is EnumClassElement) { 114 if (element.enclosingClass is EnumClassElement) {
117 if (element.name == 'index') { 115 if (element.name == 'index') {
118 kind = AstKind.ENUM_INDEX_FIELD; 116 kind = AstKind.ENUM_INDEX_FIELD;
119 } else if (element.name == 'values') { 117 } else if (element.name == 'values') {
120 kind = AstKind.ENUM_VALUES_FIELD; 118 kind = AstKind.ENUM_VALUES_FIELD;
121 } else if (element.name == 'toString') { 119 } else if (element.name == 'toString') {
122 kind = AstKind.ENUM_TO_STRING; 120 kind = AstKind.ENUM_TO_STRING;
123 } else if (element.isConstructor) { 121 } else if (element.isConstructor) {
124 kind = AstKind.ENUM_CONSTRUCTOR; 122 kind = AstKind.ENUM_CONSTRUCTOR;
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
508 Token beginToken = readBeginToken(); 506 Token beginToken = readBeginToken();
509 int getOrSetOffset = 507 int getOrSetOffset =
510 objectDecoder.getInt(Key.GET_OR_SET, isOptional: true); 508 objectDecoder.getInt(Key.GET_OR_SET, isOptional: true);
511 Token getOrSet; 509 Token getOrSet;
512 if (getOrSetOffset != null) { 510 if (getOrSetOffset != null) {
513 getOrSet = findTokenInStream(beginToken, getOrSetOffset); 511 getOrSet = findTokenInStream(beginToken, getOrSetOffset);
514 if (getOrSet == null) { 512 if (getOrSet == null) {
515 reporter.internalError( 513 reporter.internalError(
516 element, 514 element,
517 "No token found for $element in " 515 "No token found for $element in "
518 "${objectDecoder.getUri(Key.URI)} @ $getOrSetOffset"); 516 "${uri} @ $getOrSetOffset");
519 } 517 }
520 } 518 }
521 return doParse((parser) { 519 return doParse((parser) {
522 parser.parseFunction(beginToken, getOrSet); 520 parser.parseFunction(beginToken, getOrSet);
523 }); 521 });
524 } 522 }
525 } 523 }
526 524
527 AstKind kind = objectDecoder.getEnum(Key.SUB_KIND, AstKind.values); 525 AstKind kind = objectDecoder.getEnum(Key.SUB_KIND, AstKind.values);
528 Node root = computeNode(kind); 526 Node root = computeNode(kind);
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
683 } 681 }
684 } 682 }
685 } 683 }
686 element.resolvedAst = 684 element.resolvedAst =
687 new ParsedResolvedAst(element, root, body, elements, uri); 685 new ParsedResolvedAst(element, root, body, elements, uri);
688 } 686 }
689 } 687 }
690 688
691 const Key PARAMETER_NODE = const Key('parameter.node'); 689 const Key PARAMETER_NODE = const Key('parameter.node');
692 const Key PARAMETER_INITIALIZER = const Key('parameter.initializer'); 690 const Key PARAMETER_INITIALIZER = const Key('parameter.initializer');
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698