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

Unified Diff: pkg/analyzer/lib/src/generated/resolver.dart

Issue 1327363002: Fixed the last unit test that was failing with the new task model (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 3 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/generated/resolver.dart
diff --git a/pkg/analyzer/lib/src/generated/resolver.dart b/pkg/analyzer/lib/src/generated/resolver.dart
index eaed29edf9a25be7ef93a2977a4b4d52469abf2c..af5235c6a4fba9740c66fb18a63a693c3ee70c5a 100644
--- a/pkg/analyzer/lib/src/generated/resolver.dart
+++ b/pkg/analyzer/lib/src/generated/resolver.dart
@@ -9566,6 +9566,12 @@ class PartialResolverVisitor extends ResolverVisitor {
final List<VariableElement> staticVariables = <VariableElement>[];
/**
+ * A flag indicating whether we are currently visiting a child of either a
+ * field or a top-level variable.
+ */
+ bool inFieldOrTopLevelVariable = false;
+
+ /**
* A flag indicating whether we should discard errors while resolving the
* initializer for variable declarations. We do this for top-level variables
* and fields because their initializer will be re-resolved at a later time.
@@ -9600,27 +9606,39 @@ class PartialResolverVisitor extends ResolverVisitor {
@override
Object visitBlockFunctionBody(BlockFunctionBody node) {
+ if (inFieldOrTopLevelVariable) {
+ return super.visitBlockFunctionBody(node);
+ }
return null;
}
@override
Object visitExpressionFunctionBody(ExpressionFunctionBody node) {
+ if (inFieldOrTopLevelVariable) {
+ return super.visitExpressionFunctionBody(node);
+ }
return null;
}
@override
Object visitFieldDeclaration(FieldDeclaration node) {
- if (strongMode && node.isStatic) {
- _addStaticVariables(node.fields.variables);
- bool wasDiscarding = discardErrorsInInitializer;
- discardErrorsInInitializer = true;
- try {
- return super.visitFieldDeclaration(node);
- } finally {
- discardErrorsInInitializer = wasDiscarding;
+ bool wasInFieldOrTopLevelVariable = inFieldOrTopLevelVariable;
+ try {
+ inFieldOrTopLevelVariable = true;
+ if (strongMode && node.isStatic) {
+ _addStaticVariables(node.fields.variables);
+ bool wasDiscarding = discardErrorsInInitializer;
+ discardErrorsInInitializer = true;
+ try {
+ return super.visitFieldDeclaration(node);
+ } finally {
+ discardErrorsInInitializer = wasDiscarding;
+ }
}
+ return super.visitFieldDeclaration(node);
+ } finally {
+ inFieldOrTopLevelVariable = wasInFieldOrTopLevelVariable;
}
- return super.visitFieldDeclaration(node);
}
@override
@@ -9637,17 +9655,23 @@ class PartialResolverVisitor extends ResolverVisitor {
@override
Object visitTopLevelVariableDeclaration(TopLevelVariableDeclaration node) {
- if (strongMode) {
- _addStaticVariables(node.variables.variables);
- bool wasDiscarding = discardErrorsInInitializer;
- discardErrorsInInitializer = true;
- try {
- return super.visitTopLevelVariableDeclaration(node);
- } finally {
- discardErrorsInInitializer = wasDiscarding;
+ bool wasInFieldOrTopLevelVariable = inFieldOrTopLevelVariable;
+ try {
+ inFieldOrTopLevelVariable = true;
+ if (strongMode) {
+ _addStaticVariables(node.variables.variables);
+ bool wasDiscarding = discardErrorsInInitializer;
+ discardErrorsInInitializer = true;
+ try {
+ return super.visitTopLevelVariableDeclaration(node);
+ } finally {
+ discardErrorsInInitializer = wasDiscarding;
+ }
}
+ return super.visitTopLevelVariableDeclaration(node);
+ } finally {
+ inFieldOrTopLevelVariable = wasInFieldOrTopLevelVariable;
}
- return super.visitTopLevelVariableDeclaration(node);
}
/**

Powered by Google App Engine
This is Rietveld 408576698