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

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

Issue 755373003: Try to resolve incrementally whole functions, constructors or methods. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 1 month 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/generated/ast.dart ('k') | 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 c487e2e0a4a0b538828c823317ad1533874a8766..15797524c29b45cccb5add42ab6d93c0aca05fd7 100644
--- a/pkg/analyzer/lib/src/generated/incremental_resolver.dart
+++ b/pkg/analyzer/lib/src/generated/incremental_resolver.dart
@@ -895,6 +895,14 @@ class PoorMansIncrementalResolver {
for (int i = 0; i < length; i++) {
AstNode oldParent = oldParents[i];
AstNode newParent = newParents[i];
+ if (oldParent is FunctionDeclaration &&
+ newParent is FunctionDeclaration ||
+ oldParent is MethodDeclaration && newParent is MethodDeclaration ||
+ oldParent is ConstructorDeclaration && newParent is ConstructorDeclaration) {
+ oldNode = oldParent;
+ newNode = newParent;
+ found = true;
+ }
if (oldParent is FunctionBody && newParent is FunctionBody) {
oldNode = oldParent;
newNode = newParent;
@@ -911,13 +919,19 @@ class PoorMansIncrementalResolver {
_updateEndOld = oldNode.end;
_updateEndNew = newNode.end;
_updateDelta = _updateEndNew - _updateEndOld;
-// _updateDelta = lastPair.delta;
// replace node
NodeReplacer.replace(oldNode, newNode);
// update token references
- oldNode.beginToken.previous.setNext(newNode.beginToken);
- newNode.endToken.setNext(oldNode.endToken.next);
- _shiftTokens(oldNode.endToken.next, _updateDelta);
+ {
+ Token oldBeginToken = oldNode.beginToken;
+ if (oldBeginToken.previous.type == TokenType.EOF) {
+ oldUnit.beginToken = newNode.beginToken;
+ } else {
+ oldBeginToken.previous.setNext(newNode.beginToken);
+ }
+ newNode.endToken.setNext(oldNode.endToken.next);
+ _shiftTokens(oldNode.endToken.next, _updateDelta);
+ }
// perform incremental resolution
CompilationUnitElement oldUnitElement = oldUnit.element;
IncrementalResolver incrementalResolver = new IncrementalResolver(
@@ -1261,7 +1275,7 @@ class _ElementNameOffsetUpdater extends GeneralizingElementVisitor {
@override
visitElement(Element element) {
int nameOffset = element.nameOffset;
- if (nameOffset >= updateOffset) {
+ if (nameOffset > updateOffset) {
(element as ElementImpl).nameOffset = nameOffset + updateDelta;
}
super.visitElement(element);
« no previous file with comments | « pkg/analyzer/lib/src/generated/ast.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