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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library analyzer.src.task.incremental_element_builder; 5 library analyzer.src.task.incremental_element_builder;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 8
9 import 'package:analyzer/dart/ast/ast.dart'; 9 import 'package:analyzer/dart/ast/ast.dart';
10 import 'package:analyzer/dart/ast/token.dart'; 10 import 'package:analyzer/dart/ast/token.dart';
(...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after
569 offsetMap[oldToken.offset] = newToken.offset; 569 offsetMap[oldToken.offset] = newToken.offset;
570 offsetMap[oldToken.end] = newToken.end; 570 offsetMap[oldToken.end] = newToken.end;
571 oldToken.offset = newToken.offset; 571 oldToken.offset = newToken.offset;
572 // Update (otherwise unlinked) reference tokens in documentation. 572 // Update (otherwise unlinked) reference tokens in documentation.
573 if (oldToken is DocumentationCommentToken && 573 if (oldToken is DocumentationCommentToken &&
574 newToken is DocumentationCommentToken) { 574 newToken is DocumentationCommentToken) {
575 List<Token> oldReferences = oldToken.references; 575 List<Token> oldReferences = oldToken.references;
576 List<Token> newReferences = newToken.references; 576 List<Token> newReferences = newToken.references;
577 assert(oldReferences.length == newReferences.length); 577 assert(oldReferences.length == newReferences.length);
578 for (int i = 0; i < oldReferences.length; i++) { 578 for (int i = 0; i < oldReferences.length; i++) {
579 copyTokenOffsets(offsetMap, oldReferences[i], newReferences[i], 579 Token oldToken = oldReferences[i];
580 oldEndToken, newEndToken); 580 Token newToken = newReferences[i];
581 // For [new Name] the 'Name' token is the reference.
582 // But we need to process all tokens, including 'new'.
583 while (oldToken.previous != null &&
584 oldToken.previous.type != TokenType.EOF) {
585 oldToken = oldToken.previous;
586 }
587 while (newToken.previous != null &&
588 newToken.previous.type != TokenType.EOF) {
589 newToken = newToken.previous;
590 }
591 copyTokenOffsets(
592 offsetMap, oldToken, newToken, oldEndToken, newEndToken);
581 } 593 }
582 } 594 }
583 // Next tokens. 595 // Next tokens.
584 oldToken = oldToken.next; 596 oldToken = oldToken.next;
585 newToken = newToken.next; 597 newToken = newToken.next;
586 } 598 }
587 assert(oldToken == null); 599 assert(oldToken == null);
588 assert(newToken == null); 600 assert(newToken == null);
589 return; 601 return;
590 } 602 }
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
720 } 732 }
721 } 733 }
722 super.visitElement(element); 734 super.visitElement(element);
723 } 735 }
724 736
725 static bool _isVariableInitializer(Element element) { 737 static bool _isVariableInitializer(Element element) {
726 return element is FunctionElement && 738 return element is FunctionElement &&
727 element.enclosingElement is VariableElement; 739 element.enclosingElement is VariableElement;
728 } 740 }
729 } 741 }
OLDNEW
« 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