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

Unified Diff: pkg/analyzer/lib/src/task/incremental_element_builder.dart

Issue 2158083003: Update 'new' in [new Name] comment references. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 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 | « no previous file | pkg/analyzer/test/src/task/incremental_element_builder_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/task/incremental_element_builder.dart
diff --git a/pkg/analyzer/lib/src/task/incremental_element_builder.dart b/pkg/analyzer/lib/src/task/incremental_element_builder.dart
index ae0fdaf8a7cc1cc716fef19f8435942bae3808e5..e1f8c5ed49116cf209c1cb8126f6c4b5ad858c5e 100644
--- a/pkg/analyzer/lib/src/task/incremental_element_builder.dart
+++ b/pkg/analyzer/lib/src/task/incremental_element_builder.dart
@@ -576,8 +576,20 @@ class TokenUtils {
List<Token> newReferences = newToken.references;
assert(oldReferences.length == newReferences.length);
for (int i = 0; i < oldReferences.length; i++) {
- copyTokenOffsets(offsetMap, oldReferences[i], newReferences[i],
- oldEndToken, newEndToken);
+ Token oldToken = oldReferences[i];
+ Token newToken = newReferences[i];
+ // For [new Name] the 'Name' token is the reference.
+ // But we need to process all tokens, including 'new'.
+ while (oldToken.previous != null &&
+ oldToken.previous.type != TokenType.EOF) {
+ oldToken = oldToken.previous;
+ }
+ while (newToken.previous != null &&
+ newToken.previous.type != TokenType.EOF) {
+ newToken = newToken.previous;
+ }
+ copyTokenOffsets(
+ offsetMap, oldToken, newToken, oldEndToken, newEndToken);
}
}
// Next tokens.
« no previous file with comments | « no previous file | pkg/analyzer/test/src/task/incremental_element_builder_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698