OLD | NEW |
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 950 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
961 _visitCombinator(node.implementsKeyword, node.interfaces); | 961 _visitCombinator(node.implementsKeyword, node.interfaces); |
962 } | 962 } |
963 | 963 |
964 visitImportDirective(ImportDirective node) { | 964 visitImportDirective(ImportDirective node) { |
965 visitDeclarationMetadata(node.metadata); | 965 visitDeclarationMetadata(node.metadata); |
966 | 966 |
967 _simpleStatement(node, () { | 967 _simpleStatement(node, () { |
968 token(node.keyword); | 968 token(node.keyword); |
969 space(); | 969 space(); |
970 visit(node.uri); | 970 visit(node.uri); |
971 token(node.deferredKeyword, before: space); | 971 |
972 token(node.asKeyword, before: soloSplit, after: space); | 972 if (node.asKeyword != null) { |
973 visit(node.prefix); | 973 soloSplit(); |
| 974 token(node.deferredKeyword, after: space); |
| 975 token(node.asKeyword); |
| 976 space(); |
| 977 visit(node.prefix); |
| 978 } |
974 | 979 |
975 builder.startRule(new CombinatorRule()); | 980 builder.startRule(new CombinatorRule()); |
976 visitNodes(node.combinators); | 981 visitNodes(node.combinators); |
977 builder.endRule(); | 982 builder.endRule(); |
978 }); | 983 }); |
979 } | 984 } |
980 | 985 |
981 visitIndexExpression(IndexExpression node) { | 986 visitIndexExpression(IndexExpression node) { |
982 builder.nestExpression(); | 987 builder.nestExpression(); |
983 | 988 |
(...skipping 1139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2123 /// Gets the 1-based line number that the beginning of [token] lies on. | 2128 /// Gets the 1-based line number that the beginning of [token] lies on. |
2124 int _startLine(Token token) => _lineInfo.getLocation(token.offset).lineNumber; | 2129 int _startLine(Token token) => _lineInfo.getLocation(token.offset).lineNumber; |
2125 | 2130 |
2126 /// Gets the 1-based line number that the end of [token] lies on. | 2131 /// Gets the 1-based line number that the end of [token] lies on. |
2127 int _endLine(Token token) => _lineInfo.getLocation(token.end).lineNumber; | 2132 int _endLine(Token token) => _lineInfo.getLocation(token.end).lineNumber; |
2128 | 2133 |
2129 /// Gets the 1-based column number that the beginning of [token] lies on. | 2134 /// Gets the 1-based column number that the beginning of [token] lies on. |
2130 int _startColumn(Token token) => | 2135 int _startColumn(Token token) => |
2131 _lineInfo.getLocation(token.offset).columnNumber; | 2136 _lineInfo.getLocation(token.offset).columnNumber; |
2132 } | 2137 } |
OLD | NEW |