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

Unified Diff: pkg/analyzer/lib/src/summary/summarize_elements.dart

Issue 1528083002: Reserve element 0 in the references table for `dynamic`. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/analyzer/test/src/summary/summary_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/summary/summarize_elements.dart
diff --git a/pkg/analyzer/lib/src/summary/summarize_elements.dart b/pkg/analyzer/lib/src/summary/summarize_elements.dart
index 8f8277cffe11d9cc1f654662b5286546ff335733..1c28e6ec97581da3cacbad6e643c608eb372fcc1 100644
--- a/pkg/analyzer/lib/src/summary/summarize_elements.dart
+++ b/pkg/analyzer/lib/src/summary/summarize_elements.dart
@@ -93,13 +93,6 @@ class _LibrarySerializer {
//final Map<String, int> prefixIndices = <String, int>{};
/**
- * Index into the "references table" representing `dynamic`, if such an index
- * exists. `null` if no such entry has been made in the references table
- * yet.
- */
- int dynamicReferenceIndex = null;
-
- /**
* Index into the "references table" representing an unresolved reference, if
* such an index exists. `null` if no such entry has been made in the
* references table yet.
@@ -154,8 +147,12 @@ class _LibrarySerializer {
(CompilationUnitElement e) => encodeUnlinkedPart(ctx, uri: e.uri))
.toList();
}
- unlinkedReferences = <UnlinkedReferenceBuilder>[];
- prelinkedReferences = <PrelinkedReferenceBuilder>[];
+ unlinkedReferences = <UnlinkedReferenceBuilder>[
+ encodeUnlinkedReference(ctx)
+ ];
+ prelinkedReferences = <PrelinkedReferenceBuilder>[
+ encodePrelinkedReference(ctx, kind: PrelinkedReferenceKind.classOrEnum)
+ ];
b.classes = element.types.map(serializeClass).toList();
b.enums = element.enums.map(serializeEnum).toList();
b.typedefs = element.functionTypeAliases.map(serializeTypedef).toList();
@@ -310,19 +307,9 @@ class _LibrarySerializer {
/**
* Return the index of the entry in the references table
* ([UnlinkedLibrary.references] and [PrelinkedLibrary.references])
- * representing the pseudo-type `dynamic`. A new entry is added to the table
- * if necessary to satisfy the request.
+ * representing the pseudo-type `dynamic`.
*/
- int serializeDynamicReference() {
- if (dynamicReferenceIndex == null) {
- assert(unlinkedReferences.length == prelinkedReferences.length);
- dynamicReferenceIndex = unlinkedReferences.length;
- unlinkedReferences.add(encodeUnlinkedReference(ctx));
- prelinkedReferences.add(encodePrelinkedReference(ctx,
- kind: PrelinkedReferenceKind.classOrEnum));
- }
- return dynamicReferenceIndex;
- }
+ int serializeDynamicReference() => 0;
/**
* Serialize the given [enumElement], creating an [UnlinkedEnum].
« no previous file with comments | « no previous file | pkg/analyzer/test/src/summary/summary_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698