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

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

Issue 1610043002: Add propagated types to summary files. (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 side-by-side diff with in-line comments
Download patch
Index: pkg/analyzer/lib/src/summary/summarize_ast.dart
diff --git a/pkg/analyzer/lib/src/summary/summarize_ast.dart b/pkg/analyzer/lib/src/summary/summarize_ast.dart
index 1e62d4e4d4bfd79c086a71785335cb7f7b28b004..71a8395ba642c33e21f7bdf258a3513e1333e809 100644
--- a/pkg/analyzer/lib/src/summary/summarize_ast.dart
+++ b/pkg/analyzer/lib/src/summary/summarize_ast.dart
@@ -221,6 +221,16 @@ class _SummarizeAstVisitor extends SimpleAstVisitor {
UnlinkedDocumentationCommentBuilder libraryDocumentationComment;
/**
+ * The number of slot ids which have been assigned to this compilation unit.
+ */
+ int numSlots = 0;
+
+ /**
+ * Create a slot id for storing a propagated or inferred type.
+ */
+ int assignTypeSlot() => ++numSlots;
+
+ /**
* Build a [_Scope] object containing the names defined within the body of a
* class declaration.
*/
@@ -611,6 +621,10 @@ class _SummarizeAstVisitor extends SimpleAstVisitor {
b.constExpr = serializeConstExpr(initializer);
}
}
+ if (variable.initializer != null &&
+ (variables.isFinal || variables.isConst)) {
+ b.propagatedTypeSlot = assignTypeSlot();
+ }
this.variables.add(b);
}
}
« no previous file with comments | « pkg/analyzer/lib/src/summary/resynthesize.dart ('k') | pkg/analyzer/lib/src/summary/summarize_elements.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698