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

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

Issue 1581293002: Issue 25064. Incrementally resolve comments only if both are documentation. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Check types in comment incremental resolution. Created 4 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
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 b67b90552ca24c276c23451cc395685aaa95ec76..6fc925ba0c8dad64f204afac263792b964211153 100644
--- a/pkg/analyzer/lib/src/generated/incremental_resolver.dart
+++ b/pkg/analyzer/lib/src/generated/incremental_resolver.dart
@@ -597,12 +597,12 @@ class DeclarationMatcher extends RecursiveAstVisitor {
}
void _assertSameAnnotations(AnnotatedNode node, Element element) {
- List<Annotation> nodeAnnotaitons = node.metadata;
+ List<Annotation> nodeAnnotations = node.metadata;
List<ElementAnnotation> elementAnnotations = element.metadata;
- int length = nodeAnnotaitons.length;
+ int length = nodeAnnotations.length;
_assertEquals(elementAnnotations.length, length);
for (int i = 0; i < length; i++) {
- _assertSameAnnotation(nodeAnnotaitons[i], elementAnnotations[i]);
+ _assertSameAnnotation(nodeAnnotations[i], elementAnnotations[i]);
}
}
@@ -1555,8 +1555,7 @@ class PoorMansIncrementalResolver {
return true;
}
} catch (e, st) {
- logger.log(e);
- logger.log(st);
+ logger.logException(e, st);
logger.log('Failure: exception.');
} finally {
logger.exit();
@@ -1595,8 +1594,13 @@ class PoorMansIncrementalResolver {
// find nodes
int offset = oldComments.offset;
logger.log('offset: $offset');
- Comment oldComment = _findNodeCovering(_oldUnit, offset, offset);
- Comment newComment = _findNodeCovering(newUnit, offset, offset);
+ AstNode oldNode = _findNodeCovering(_oldUnit, offset, offset);
+ AstNode newNode = _findNodeCovering(newUnit, offset, offset);
+ if (oldNode is! Comment || newNode is! Comment) {
+ return false;
+ }
+ Comment oldComment = oldNode;
+ Comment newComment = newNode;
logger.log('oldComment.beginToken: ${oldComment.beginToken}');
logger.log('newComment.beginToken: ${newComment.beginToken}');
_updateOffset = oldToken.offset - 1;
@@ -1733,7 +1737,7 @@ class PoorMansIncrementalResolver {
Token newComment = newToken.precedingComments;
if (_compareToken(oldComment, newComment, 0, true) != null) {
_TokenDifferenceKind diffKind = _TokenDifferenceKind.COMMENT;
- if (oldComment is DocumentationCommentToken ||
+ if (oldComment is DocumentationCommentToken &&
newComment is DocumentationCommentToken) {
diffKind = _TokenDifferenceKind.COMMENT_DOC;
}
@@ -1769,7 +1773,7 @@ class PoorMansIncrementalResolver {
Token newComment = newToken.precedingComments;
if (_compareToken(oldComment, newComment, delta, true) != null) {
_TokenDifferenceKind diffKind = _TokenDifferenceKind.COMMENT;
- if (oldComment is DocumentationCommentToken ||
+ if (oldComment is DocumentationCommentToken &&
newComment is DocumentationCommentToken) {
diffKind = _TokenDifferenceKind.COMMENT_DOC;
}

Powered by Google App Engine
This is Rietveld 408576698