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

Side by Side Diff: pkg/analyzer/lib/src/summary/summarize_elements.dart

Issue 1576743002: Create a prelinker for summaries. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 11 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) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 serialization.elements; 5 library serialization.elements;
6 6
7 import 'package:analyzer/dart/element/element.dart'; 7 import 'package:analyzer/dart/element/element.dart';
8 import 'package:analyzer/dart/element/type.dart'; 8 import 'package:analyzer/dart/element/type.dart';
9 import 'package:analyzer/src/dart/element/type.dart'; 9 import 'package:analyzer/src/dart/element/type.dart';
10 import 'package:analyzer/src/generated/resolver.dart'; 10 import 'package:analyzer/src/generated/resolver.dart';
(...skipping 713 matching lines...) Expand 10 before | Expand all | Expand 10 after
724 724
725 /** 725 /**
726 * Return the index of the entry in the references table 726 * Return the index of the entry in the references table
727 * ([UnlinkedLibrary.references] and [PrelinkedLibrary.references]) used for 727 * ([UnlinkedLibrary.references] and [PrelinkedLibrary.references]) used for
728 * unresolved references. A new entry is added to the table if necessary to 728 * unresolved references. A new entry is added to the table if necessary to
729 * satisfy the request. 729 * satisfy the request.
730 */ 730 */
731 int serializeUnresolvedReference() { 731 int serializeUnresolvedReference() {
732 // TODO(paulberry): in order for relinking to work, we need to record the 732 // TODO(paulberry): in order for relinking to work, we need to record the
733 // name and prefix of the unresolved symbol. This is not (yet) encoded in 733 // name and prefix of the unresolved symbol. This is not (yet) encoded in
734 // the element model. 734 // the element model. For the moment we use a name that can't possibly
735 // ever exist.
735 if (unresolvedReferenceIndex == null) { 736 if (unresolvedReferenceIndex == null) {
736 assert(unlinkedReferences.length == prelinkedReferences.length); 737 assert(unlinkedReferences.length == prelinkedReferences.length);
737 unresolvedReferenceIndex = unlinkedReferences.length; 738 unresolvedReferenceIndex = unlinkedReferences.length;
738 unlinkedReferences.add(encodeUnlinkedReference(ctx)); 739 unlinkedReferences
740 .add(encodeUnlinkedReference(ctx, name: '*unresolved*'));
739 prelinkedReferences.add(encodePrelinkedReference(ctx, 741 prelinkedReferences.add(encodePrelinkedReference(ctx,
740 kind: PrelinkedReferenceKind.unresolved)); 742 kind: PrelinkedReferenceKind.unresolved));
741 } 743 }
742 return unresolvedReferenceIndex; 744 return unresolvedReferenceIndex;
743 } 745 }
744 746
745 /** 747 /**
746 * Serialize the given [variable], creating an [UnlinkedVariable]. 748 * Serialize the given [variable], creating an [UnlinkedVariable].
747 */ 749 */
748 UnlinkedVariableBuilder serializeVariable(PropertyInducingElement variable) { 750 UnlinkedVariableBuilder serializeVariable(PropertyInducingElement variable) {
749 UnlinkedVariableBuilder b = new UnlinkedVariableBuilder(ctx); 751 UnlinkedVariableBuilder b = new UnlinkedVariableBuilder(ctx);
750 b.name = variable.name; 752 b.name = variable.name;
751 b.nameOffset = variable.nameOffset; 753 b.nameOffset = variable.nameOffset;
752 b.type = serializeTypeRef(variable.type, variable); 754 b.type = serializeTypeRef(variable.type, variable);
753 b.isStatic = variable.isStatic && variable.enclosingElement is ClassElement; 755 b.isStatic = variable.isStatic && variable.enclosingElement is ClassElement;
754 b.isFinal = variable.isFinal; 756 b.isFinal = variable.isFinal;
755 b.isConst = variable.isConst; 757 b.isConst = variable.isConst;
756 b.hasImplicitType = variable.hasImplicitType; 758 b.hasImplicitType = variable.hasImplicitType;
757 b.documentationComment = serializeDocumentation(variable); 759 b.documentationComment = serializeDocumentation(variable);
758 return b; 760 return b;
759 } 761 }
760 } 762 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698