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

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

Issue 1762663002: Add support for ConstructorElementImpl.isCycleFree to summaries. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 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 cd9ff614ccf7b36e66e5ebc8632421bf5f899f61..d0ad34c7503559df9b7d8a4844911b3122fd648d 100644
--- a/pkg/analyzer/lib/src/summary/summarize_ast.dart
+++ b/pkg/analyzer/lib/src/summary/summarize_ast.dart
@@ -296,9 +296,10 @@ class _SummarizeAstVisitor extends RecursiveAstVisitor {
Block enclosingBlock = null;
/**
- * Create a slot id for storing a propagated or inferred type.
+ * Create a slot id for storing a propagated or inferred type or const cycle
+ * info.
*/
- int assignTypeSlot() => ++numSlots;
+ int assignSlot() => ++numSlots;
/**
* Build a [_Scope] object containing the names defined within the body of a
@@ -529,7 +530,7 @@ class _SummarizeAstVisitor extends RecursiveAstVisitor {
for (int i = 0; i < formalParameters.parameters.length; i++) {
if (!b.parameters[i].isFunctionTyped &&
b.parameters[i].type == null) {
- b.parameters[i].inferredTypeSlot = assignTypeSlot();
+ b.parameters[i].inferredTypeSlot = assignSlot();
}
}
}
@@ -537,7 +538,7 @@ class _SummarizeAstVisitor extends RecursiveAstVisitor {
b.documentationComment = serializeDocumentation(documentationComment);
b.annotations = serializeAnnotations(annotations);
if (returnType == null && !isSemanticallyStatic) {
- b.inferredReturnTypeSlot = assignTypeSlot();
+ b.inferredReturnTypeSlot = assignSlot();
}
b.visibleOffset = enclosingBlock?.offset;
b.visibleLength = enclosingBlock?.length;
@@ -601,7 +602,7 @@ class _SummarizeAstVisitor extends RecursiveAstVisitor {
UnlinkedExecutableBuilder initializer =
new UnlinkedExecutableBuilder(nameOffset: expression.offset);
serializeFunctionBody(initializer, expression);
- initializer.inferredReturnTypeSlot = assignTypeSlot();
+ initializer.inferredReturnTypeSlot = assignSlot();
return initializer;
}
@@ -780,12 +781,12 @@ class _SummarizeAstVisitor extends RecursiveAstVisitor {
}
if (variable.initializer != null &&
(variables.isFinal || variables.isConst)) {
- b.propagatedTypeSlot = assignTypeSlot();
+ b.propagatedTypeSlot = assignSlot();
}
bool isSemanticallyStatic = !isField || isDeclaredStatic;
if (variables.type == null &&
(variable.initializer != null || !isSemanticallyStatic)) {
- b.inferredTypeSlot = assignTypeSlot();
+ b.inferredTypeSlot = assignSlot();
}
b.visibleOffset = enclosingBlock?.offset;
b.visibleLength = enclosingBlock?.length;
@@ -867,7 +868,10 @@ class _SummarizeAstVisitor extends RecursiveAstVisitor {
}
}
}
- b.isConst = node.constKeyword != null;
+ if (node.constKeyword != null) {
+ b.isConst = true;
+ b.constCycleSlot = assignSlot();
+ }
b.isExternal = node.externalKeyword != null;
b.documentationComment = serializeDocumentation(node.documentationComment);
b.annotations = serializeAnnotations(node.metadata);
« 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