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

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

Issue 836763002: Issue 21842. Fix for incremental resolution of function expressions in top-level variables. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 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
« no previous file with comments | « no previous file | pkg/analyzer/test/generated/incremental_resolver_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/generated/incremental_resolver.dart
diff --git a/pkg/analyzer/lib/src/generated/incremental_resolver.dart b/pkg/analyzer/lib/src/generated/incremental_resolver.dart
index f3f99eb7c7da6fff13f134f6c816182faec37b49..3b6709af68b0bb570db5c60a9a99219e4ef0adbf 100644
--- a/pkg/analyzer/lib/src/generated/incremental_resolver.dart
+++ b/pkg/analyzer/lib/src/generated/incremental_resolver.dart
@@ -393,6 +393,7 @@ class DeclarationMatcher extends RecursiveAstVisitor {
element = _findElement(_enclosingClass.fields, name);
}
// verify
+ PropertyInducingElement newElement = node.name.staticElement;
_assertNotNull(element);
_processElement(element);
_assertEquals(node.isConst, element.isConst);
@@ -405,6 +406,9 @@ class DeclarationMatcher extends RecursiveAstVisitor {
element.type);
// matches, restore the existing element
node.name.staticElement = element;
+ if (element is VariableElementImpl) {
+ (element as VariableElementImpl).initializer = newElement.initializer;
+ }
}
@override
@@ -911,7 +915,8 @@ class IncrementalResolver {
node is ConstructorDeclaration ||
node is FunctionDeclaration ||
node is FunctionTypeAlias ||
- node is MethodDeclaration;
+ node is MethodDeclaration ||
+ node is TopLevelVariableDeclaration;
void _fillResolutionQueue(DeclarationMatcher matcher) {
HashSet<Element> removedElements = matcher._removedElements;
« no previous file with comments | « no previous file | pkg/analyzer/test/generated/incremental_resolver_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698