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

Side by Side Diff: lib/src/source_visitor.dart

Issue 792953003: Visit all components of dotted library name. Fixes #109. (Closed) Base URL: https://github.com/dart-lang/dart_style.git@master
Patch Set: Created 5 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 unified diff | Download patch
« no previous file with comments | « no previous file | test/comments/top_level.unit » ('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) 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 dart_style.src.source_visitor; 5 library dart_style.src.source_visitor;
6 6
7 import 'package:analyzer/analyzer.dart'; 7 import 'package:analyzer/analyzer.dart';
8 import 'package:analyzer/src/generated/scanner.dart'; 8 import 'package:analyzer/src/generated/scanner.dart';
9 import 'package:analyzer/src/generated/source.dart'; 9 import 'package:analyzer/src/generated/source.dart';
10 10
(...skipping 790 matching lines...) Expand 10 before | Expand all | Expand 10 after
801 801
802 visitLibraryDirective(LibraryDirective node) { 802 visitLibraryDirective(LibraryDirective node) {
803 visitDeclarationMetadata(node.metadata); 803 visitDeclarationMetadata(node.metadata);
804 token(node.keyword); 804 token(node.keyword);
805 space(); 805 space();
806 visit(node.name); 806 visit(node.name);
807 token(node.semicolon); 807 token(node.semicolon);
808 } 808 }
809 809
810 visitLibraryIdentifier(LibraryIdentifier node) { 810 visitLibraryIdentifier(LibraryIdentifier node) {
811 token(node.beginToken); 811 visit(node.components.first);
812 for (var component in node.components.skip(1)) {
813 token(component.beginToken.previous); // "."
814 visit(component);
815 }
812 } 816 }
813 817
814 visitListLiteral(ListLiteral node) { 818 visitListLiteral(ListLiteral node) {
815 _visitCollectionLiteral( 819 _visitCollectionLiteral(
816 node, node.leftBracket, node.elements, node.rightBracket); 820 node, node.leftBracket, node.elements, node.rightBracket);
817 } 821 }
818 822
819 visitMapLiteral(MapLiteral node) { 823 visitMapLiteral(MapLiteral node) {
820 _visitCollectionLiteral( 824 _visitCollectionLiteral(
821 node, node.leftBracket, node.entries, node.rightBracket); 825 node, node.leftBracket, node.entries, node.rightBracket);
(...skipping 743 matching lines...) Expand 10 before | Expand all | Expand 10 after
1565 /// Gets the 1-based line number that the beginning of [token] lies on. 1569 /// Gets the 1-based line number that the beginning of [token] lies on.
1566 int _startLine(Token token) => _lineInfo.getLocation(token.offset).lineNumber; 1570 int _startLine(Token token) => _lineInfo.getLocation(token.offset).lineNumber;
1567 1571
1568 /// Gets the 1-based line number that the end of [token] lies on. 1572 /// Gets the 1-based line number that the end of [token] lies on.
1569 int _endLine(Token token) => _lineInfo.getLocation(token.end).lineNumber; 1573 int _endLine(Token token) => _lineInfo.getLocation(token.end).lineNumber;
1570 1574
1571 /// Gets the 1-based column number that the beginning of [token] lies on. 1575 /// Gets the 1-based column number that the beginning of [token] lies on.
1572 int _startColumn(Token token) => 1576 int _startColumn(Token token) =>
1573 _lineInfo.getLocation(token.offset).columnNumber; 1577 _lineInfo.getLocation(token.offset).columnNumber;
1574 } 1578 }
OLDNEW
« no previous file with comments | « no previous file | test/comments/top_level.unit » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698