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

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

Issue 2963183002: Don't serialize local variables. (Closed)
Patch Set: Rebase after removing ExecutableElement.localVariables Created 3 years, 5 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
« no previous file with comments | « pkg/analyzer/lib/src/summary/idl.dart ('k') | pkg/analyzer/test/src/summary/summarize_ast_strong_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_ast.dart
diff --git a/pkg/analyzer/lib/src/summary/summarize_ast.dart b/pkg/analyzer/lib/src/summary/summarize_ast.dart
index e1d45ce408f4c4edcaa49a4adf1d732065772ad1..ec83c64d3f1375eb4a9f43d7acf8684df7272980 100644
--- a/pkg/analyzer/lib/src/summary/summarize_ast.dart
+++ b/pkg/analyzer/lib/src/summary/summarize_ast.dart
@@ -251,8 +251,8 @@ class _SummarizeAstVisitor extends RecursiveAstVisitor {
final List<UnlinkedTypedefBuilder> typedefs = <UnlinkedTypedefBuilder>[];
/**
- * List of objects which should be written to [UnlinkedUnit.variables],
- * [UnlinkedClass.fields] or [UnlinkedExecutable.localVariables].
+ * List of objects which should be written to [UnlinkedUnit.variables] or
+ * [UnlinkedClass.fields].
*/
List<UnlinkedVariableBuilder> variables = <UnlinkedVariableBuilder>[];
@@ -559,36 +559,6 @@ class _SummarizeAstVisitor extends RecursiveAstVisitor {
}
/**
- * Serialize the given [declaredIdentifier] into [UnlinkedVariable], and
- * store it in [variables].
- */
- void serializeDeclaredIdentifier(
- AstNode scopeNode,
- Comment documentationComment,
- NodeList<Annotation> annotations,
- bool isFinal,
- bool isConst,
- TypeAnnotation type,
- bool assignPropagatedTypeSlot,
- SimpleIdentifier declaredIdentifier) {
- UnlinkedVariableBuilder b = new UnlinkedVariableBuilder();
- b.isFinal = isFinal;
- b.isConst = isConst;
- b.name = declaredIdentifier.name;
- b.nameOffset = declaredIdentifier.offset;
- b.type = serializeTypeName(type);
- b.documentationComment = serializeDocumentation(documentationComment);
- b.annotations = serializeAnnotations(annotations);
- b.codeRange = serializeCodeRange(declaredIdentifier);
- if (assignPropagatedTypeSlot) {
- b.propagatedTypeSlot = assignSlot();
- }
- b.visibleOffset = scopeNode?.offset;
- b.visibleLength = scopeNode?.length;
- this.variables.add(b);
- }
-
- /**
* Serialize a [Comment] node into an [UnlinkedDocumentationComment] object.
*/
UnlinkedDocumentationCommentBuilder serializeDocumentation(
@@ -734,12 +704,10 @@ class _SummarizeAstVisitor extends RecursiveAstVisitor {
}
List<UnlinkedExecutableBuilder> oldExecutables = executables;
List<UnlinkedLabelBuilder> oldLabels = labels;
- List<UnlinkedVariableBuilder> oldVariables = variables;
Map<int, int> oldLocalClosureIndexMap = _localClosureIndexMap;
bool oldSerializeClosureBodyExprs = _serializeClosureBodyExprs;
executables = <UnlinkedExecutableBuilder>[];
labels = <UnlinkedLabelBuilder>[];
- variables = <UnlinkedVariableBuilder>[];
_localClosureIndexMap = <int, int>{};
_serializeClosureBodyExprs = serializeBodyExpr;
if (initializers != null) {
@@ -763,11 +731,9 @@ class _SummarizeAstVisitor extends RecursiveAstVisitor {
}
b.localFunctions = executables;
b.localLabels = labels;
- b.localVariables = variables;
Map<int, int> localClosureIndexMap = _localClosureIndexMap;
executables = oldExecutables;
labels = oldLabels;
- variables = oldVariables;
_localClosureIndexMap = oldLocalClosureIndexMap;
_serializeClosureBodyExprs = oldSerializeClosureBodyExprs;
return localClosureIndexMap;
@@ -1002,7 +968,6 @@ class _SummarizeAstVisitor extends RecursiveAstVisitor {
* in [this.variables].
*/
void serializeVariables(
- AstNode scopeNode,
VariableDeclarationList variables,
bool isDeclaredStatic,
Comment documentationComment,
@@ -1040,8 +1005,6 @@ class _SummarizeAstVisitor extends RecursiveAstVisitor {
(variable.initializer != null || !isSemanticallyStatic)) {
b.inferredTypeSlot = assignSlot();
}
- b.visibleOffset = scopeNode?.offset;
- b.visibleLength = scopeNode?.length;
this.variables.add(b);
}
}
@@ -1055,21 +1018,6 @@ class _SummarizeAstVisitor extends RecursiveAstVisitor {
}
@override
- void visitCatchClause(CatchClause node) {
- SimpleIdentifier exception = node.exceptionParameter;
- SimpleIdentifier st = node.stackTraceParameter;
- if (exception != null) {
- serializeDeclaredIdentifier(
- node, null, null, false, false, node.exceptionType, false, exception);
- }
- if (st != null) {
- serializeDeclaredIdentifier(
- node, null, null, false, false, null, false, st);
- }
- super.visitCatchClause(node);
- }
-
- @override
void visitClassDeclaration(ClassDeclaration node) {
TypeName superclass =
node.extendsClause == null ? null : node.extendsClause.superclass;
@@ -1207,7 +1155,7 @@ class _SummarizeAstVisitor extends RecursiveAstVisitor {
@override
void visitFieldDeclaration(FieldDeclaration node) {
- serializeVariables(null, node.fields, node.staticKeyword != null,
+ serializeVariables(node.fields, node.staticKeyword != null,
node.documentationComment, node.metadata, true);
}
@@ -1227,32 +1175,6 @@ class _SummarizeAstVisitor extends RecursiveAstVisitor {
}
@override
- void visitForEachStatement(ForEachStatement node) {
- DeclaredIdentifier loopVariable = node.loopVariable;
- if (loopVariable != null) {
- serializeDeclaredIdentifier(
- node,
- loopVariable.documentationComment,
- loopVariable.metadata,
- loopVariable.isFinal,
- loopVariable.isConst,
- loopVariable.type,
- true,
- loopVariable.identifier);
- }
- super.visitForEachStatement(node);
- }
-
- @override
- void visitForStatement(ForStatement node) {
- VariableDeclarationList declaredVariables = node.variables;
- if (declaredVariables != null) {
- serializeVariables(node, declaredVariables, false, null, null, false);
- }
- super.visitForStatement(node);
- }
-
- @override
void visitFunctionDeclaration(FunctionDeclaration node) {
executables.add(serializeExecutable(
node,
@@ -1451,8 +1373,8 @@ class _SummarizeAstVisitor extends RecursiveAstVisitor {
@override
void visitTopLevelVariableDeclaration(TopLevelVariableDeclaration node) {
- serializeVariables(null, node.variables, false, node.documentationComment,
- node.metadata, false);
+ serializeVariables(
+ node.variables, false, node.documentationComment, node.metadata, false);
}
@override
@@ -1470,8 +1392,7 @@ class _SummarizeAstVisitor extends RecursiveAstVisitor {
@override
void visitVariableDeclarationStatement(VariableDeclarationStatement node) {
- serializeVariables(
- enclosingBlock, node.variables, false, null, null, false);
+ // TODO(scheglov) Remove when we stop serializing local functions.
}
/**
« no previous file with comments | « pkg/analyzer/lib/src/summary/idl.dart ('k') | pkg/analyzer/test/src/summary/summarize_ast_strong_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698