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

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

Issue 1220633003: Try incremental analysis before limiting invalidation. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 6 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/incremental_resolver.dart
diff --git a/pkg/analyzer/lib/src/generated/incremental_resolver.dart b/pkg/analyzer/lib/src/generated/incremental_resolver.dart
index 90065ecc2b1c59fa782acdf8edfed71580368ed1..3cc06268aa9276ec4731b9fbaf5dd06bfdbf2ec6 100644
--- a/pkg/analyzer/lib/src/generated/incremental_resolver.dart
+++ b/pkg/analyzer/lib/src/generated/incremental_resolver.dart
@@ -361,17 +361,19 @@ class DeclarationMatcher extends RecursiveAstVisitor {
node.name.staticElement = element;
_setLocalElements(element, newElement);
} on _DeclarationMismatchException {
- _addedElements.add(newElement);
_removeElement(element);
// add new element
- if (newElement is MethodElement) {
- List<MethodElement> methods = _enclosingClass.methods;
- methods.add(newElement);
- _enclosingClass.methods = methods;
- } else {
- List<PropertyAccessorElement> accessors = _enclosingClass.accessors;
- accessors.add(newElement);
- _enclosingClass.accessors = accessors;
+ if (newElement != null) {
+ _addedElements.add(newElement);
+ if (newElement is MethodElement) {
+ List<MethodElement> methods = _enclosingClass.methods;
+ methods.add(newElement);
+ _enclosingClass.methods = methods;
+ } else {
+ List<PropertyAccessorElement> accessors = _enclosingClass.accessors;
+ accessors.add(newElement);
+ _enclosingClass.accessors = accessors;
+ }
}
}
}
@@ -790,10 +792,12 @@ class DeclarationMatcher extends RecursiveAstVisitor {
static void _setLocalElements(
ExecutableElementImpl to, ExecutableElement from) {
- to.functions = from.functions;
- to.labels = from.labels;
- to.localVariables = from.localVariables;
- to.parameters = from.parameters;
+ if (from != null) {
+ to.functions = from.functions;
+ to.labels = from.labels;
+ to.localVariables = from.localVariables;
+ to.parameters = from.parameters;
+ }
}
}
@@ -1395,9 +1399,13 @@ class PoorMansIncrementalResolver {
newParent is MethodDeclaration ||
oldParent is ConstructorDeclaration &&
newParent is ConstructorDeclaration) {
- oldNode = oldParent;
- newNode = newParent;
- found = true;
+ Element oldElement = (oldParent as Declaration).element;
+ if (new DeclarationMatcher().matches(newParent, oldElement) ==
+ DeclarationMatchKind.MATCH) {
+ oldNode = oldParent;
+ newNode = newParent;
+ found = true;
+ }
}
if (oldParent is FunctionBody && newParent is FunctionBody) {
oldNode = oldParent;
« no previous file with comments | « pkg/analyzer/lib/src/context/context.dart ('k') | pkg/analyzer/test/generated/incremental_resolver_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698