| 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 2fdf505ef7d000d67b40316b2bab9320487ab261..4a456199214ffed0ab3652516e44600d95fbff87 100644
|
| --- a/pkg/analyzer/lib/src/generated/incremental_resolver.dart
|
| +++ b/pkg/analyzer/lib/src/generated/incremental_resolver.dart
|
| @@ -1189,12 +1189,6 @@ class PoorMansIncrementalResolver {
|
| _updateEndOld = endOffsetOld;
|
| _updateEndNew = endOffsetNew;
|
| _updateDelta = newUnit.length - _oldUnit.length;
|
| - // A comment change.
|
| - if (firstPair.kind == _TokenDifferenceKind.COMMENT) {
|
| - bool success = _resolveComment(newUnit, firstPair);
|
| - logger.log('Comment change: $success');
|
| - return success;
|
| - }
|
| // A Dart documentation comment change.
|
| if (firstPair.kind == _TokenDifferenceKind.COMMENT_DOC) {
|
| bool success = _resolveCommentDoc(newUnit, firstPair);
|
| @@ -1254,6 +1248,13 @@ class PoorMansIncrementalResolver {
|
| logger.log('Failure: no enclosing function body or executable.');
|
| return false;
|
| }
|
| + // fail if a comment change outside the bodies
|
| + if (firstPair.kind == _TokenDifferenceKind.COMMENT) {
|
| + if (beginOffsetOld <= oldNode.offset || beginOffsetNew <= newNode.offset) {
|
| + logger.log('Failure: comment outside a function body.');
|
| + return false;
|
| + }
|
| + }
|
| }
|
| logger.log(() => 'oldNode: $oldNode');
|
| logger.log(() => 'newNode: $newNode');
|
| @@ -1315,28 +1316,6 @@ class PoorMansIncrementalResolver {
|
| }
|
|
|
| /**
|
| - * Attempts to resolve a comment change.
|
| - * Returns `true` if success.
|
| - */
|
| - bool _resolveComment(CompilationUnit newUnit, _TokenPair firstPair) {
|
| - Token oldToken = firstPair.oldToken;
|
| - Token newToken = firstPair.newToken;
|
| - CommentToken newComments = newToken.precedingComments;
|
| - // update token references
|
| - _updateOffset = oldToken.offset - 1;
|
| - _shiftTokens(firstPair.oldToken);
|
| - _setPrecedingComments(oldToken, newComments);
|
| - // update elements
|
| - IncrementalResolver incrementalResolver = new IncrementalResolver(
|
| - _unitElement, _updateOffset, _updateEndOld, _updateEndNew);
|
| - incrementalResolver._updateElementNameOffsets();
|
| - incrementalResolver._shiftEntryErrors();
|
| - _updateEntry();
|
| - // OK
|
| - return true;
|
| - }
|
| -
|
| - /**
|
| * Attempts to resolve a documentation comment change.
|
| * Returns `true` if success.
|
| */
|
| @@ -1390,24 +1369,8 @@ class PoorMansIncrementalResolver {
|
| token.precedingComments = comment;
|
| } else if (token is KeywordTokenWithComment) {
|
| token.precedingComments = comment;
|
| - } else if (token is KeywordToken) {
|
| - KeywordTokenWithComment newToken =
|
| - new KeywordTokenWithComment(token.keyword, token.offset, comment);
|
| - token.previous.setNext(newToken);
|
| - newToken.setNext(token.next);
|
| - if (_oldUnit.beginToken == token) {
|
| - _oldUnit.beginToken = newToken;
|
| - }
|
| } else if (token is StringTokenWithComment) {
|
| token.precedingComments = comment;
|
| - } else if (token is StringToken) {
|
| - StringTokenWithComment newToken = new StringTokenWithComment(
|
| - token.type, token.value(), token.offset, comment);
|
| - token.previous.setNext(newToken);
|
| - newToken.setNext(token.next);
|
| - if (_oldUnit.beginToken == token) {
|
| - _oldUnit.beginToken = newToken;
|
| - }
|
| } else if (token is TokenWithComment) {
|
| token.precedingComments = comment;
|
| } else {
|
|
|