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

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

Issue 824783003: Incrementally resolve only update to dartdocs, fail if add/remove. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 12 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 | no next file » | 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 ab02202fe8a96c944f330ec64b2aa0d0a24ba162..d5769f9ebba50ecba01d8d9778445ea5326611a0 100644
--- a/pkg/analyzer/lib/src/generated/incremental_resolver.dart
+++ b/pkg/analyzer/lib/src/generated/incremental_resolver.dart
@@ -1212,9 +1212,9 @@ class PoorMansIncrementalResolver {
_updateDelta = newUnit.length - oldUnit.length;
// A Dart documentation comment change.
if (firstPair.kind == _TokenDifferenceKind.COMMENT_DOC) {
- _resolveComment(oldUnit, newUnit, firstPair);
- logger.log('Success.');
- return true;
+ bool success = _resolveComment(oldUnit, newUnit, firstPair);
+ logger.log('Documentation comment resolved: $success');
+ return success;
}
// A pure whitespace change.
if (firstPair.kind == _TokenDifferenceKind.OFFSET) {
@@ -1333,11 +1333,21 @@ class PoorMansIncrementalResolver {
}
}
- void _resolveComment(CompilationUnit oldUnit, CompilationUnit newUnit,
+ /**
+ * Attempts to resolve a documentation comment change.
+ * Returns `true` if success.
+ */
+ bool _resolveComment(CompilationUnit oldUnit, CompilationUnit newUnit,
_TokenPair firstPair) {
Token oldToken = firstPair.oldToken;
- CommentToken precedingComments = oldToken.precedingComments;
- int offset = precedingComments.offset;
+ Token newToken = firstPair.newToken;
+ CommentToken oldComments = oldToken.precedingComments;
+ CommentToken newComments = newToken.precedingComments;
+ if (oldComments == null || newComments == null) {
+ return false;
+ }
+ // find nodes
+ int offset = oldComments.offset;
logger.log('offset: $offset');
Comment oldComment = _findNodeCovering(oldUnit, offset, offset);
Comment newComment = _findNodeCovering(newUnit, offset, offset);
@@ -1359,6 +1369,8 @@ class PoorMansIncrementalResolver {
_updateEntry();
// resolve references in the comment
incrementalResolver._resolveReferences(newComment);
+ // OK
+ return true;
}
Token _scan(String code) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698