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

Side by Side Diff: pkg/analyzer/lib/src/generated/incremental_resolver.dart

Issue 1918923003: Remove unnecessary casts and general code clean-up (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 7 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
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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.generated.incremental_resolver; 5 library analyzer.src.generated.incremental_resolver;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 import 'dart:math' as math; 8 import 'dart:math' as math;
9 9
10 import 'package:analyzer/dart/ast/ast.dart'; 10 import 'package:analyzer/dart/ast/ast.dart';
(...skipping 1668 matching lines...) Expand 10 before | Expand all | Expand 10 after
1679 incrementalResolver._resolveReferences(newComment); 1679 incrementalResolver._resolveReferences(newComment);
1680 // update 'documentationComment' of the parent element(s) 1680 // update 'documentationComment' of the parent element(s)
1681 { 1681 {
1682 AstNode parent = newComment.parent; 1682 AstNode parent = newComment.parent;
1683 if (parent is AnnotatedNode) { 1683 if (parent is AnnotatedNode) {
1684 Element parentElement = ElementLocator.locate(newComment.parent); 1684 Element parentElement = ElementLocator.locate(newComment.parent);
1685 if (parentElement is ElementImpl) { 1685 if (parentElement is ElementImpl) {
1686 setElementDocumentationComment(parentElement, parent); 1686 setElementDocumentationComment(parentElement, parent);
1687 } else if (parentElement == null && parent is FieldDeclaration) { 1687 } else if (parentElement == null && parent is FieldDeclaration) {
1688 for (VariableDeclaration field in parent.fields.variables) { 1688 for (VariableDeclaration field in parent.fields.variables) {
1689 if (field.element is ElementImpl) { 1689 Element fieldElement = field.element;
1690 setElementDocumentationComment( 1690 if (fieldElement is ElementImpl) {
1691 field.element as ElementImpl, parent); 1691 setElementDocumentationComment(fieldElement, parent);
1692 } 1692 }
1693 } 1693 }
1694 } 1694 }
1695 } 1695 }
1696 } 1696 }
1697 // OK 1697 // OK
1698 return true; 1698 return true;
1699 } 1699 }
1700 1700
1701 Token _scan(String code) { 1701 Token _scan(String code) {
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
1859 } 1859 }
1860 1860
1861 static AstNode _findNodeCovering(AstNode root, int offset, int end) { 1861 static AstNode _findNodeCovering(AstNode root, int offset, int end) {
1862 NodeLocator nodeLocator = new NodeLocator(offset, end); 1862 NodeLocator nodeLocator = new NodeLocator(offset, end);
1863 return nodeLocator.searchWithin(root); 1863 return nodeLocator.searchWithin(root);
1864 } 1864 }
1865 1865
1866 static Token _getBeginTokenNotComment(AstNode node) { 1866 static Token _getBeginTokenNotComment(AstNode node) {
1867 Token oldBeginToken = node.beginToken; 1867 Token oldBeginToken = node.beginToken;
1868 if (oldBeginToken is CommentToken) { 1868 if (oldBeginToken is CommentToken) {
1869 oldBeginToken = (oldBeginToken as CommentToken).parent; 1869 return oldBeginToken.parent;
1870 } 1870 }
1871 return oldBeginToken; 1871 return oldBeginToken;
1872 } 1872 }
1873 1873
1874 static List<AstNode> _getParents(AstNode node) { 1874 static List<AstNode> _getParents(AstNode node) {
1875 List<AstNode> parents = <AstNode>[]; 1875 List<AstNode> parents = <AstNode>[];
1876 while (node != null) { 1876 while (node != null) {
1877 parents.insert(0, node); 1877 parents.insert(0, node);
1878 node = node.parent; 1878 node = node.parent;
1879 } 1879 }
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after
2236 @override 2236 @override
2237 String toString() => name; 2237 String toString() => name;
2238 } 2238 }
2239 2239
2240 class _TokenPair { 2240 class _TokenPair {
2241 final _TokenDifferenceKind kind; 2241 final _TokenDifferenceKind kind;
2242 final Token oldToken; 2242 final Token oldToken;
2243 final Token newToken; 2243 final Token newToken;
2244 _TokenPair(this.kind, this.oldToken, this.newToken); 2244 _TokenPair(this.kind, this.oldToken, this.newToken);
2245 } 2245 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698