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/dart/ast/token.dart'; | 8 import 'package:analyzer/dart/ast/token.dart'; |
9 import 'package:analyzer/src/generated/source.dart'; | 9 import 'package:analyzer/src/generated/source.dart'; |
10 | 10 |
(...skipping 1187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1198 /// call chains. | 1198 /// call chains. |
1199 void finishIndexExpression(IndexExpression node) { | 1199 void finishIndexExpression(IndexExpression node) { |
1200 if (node.target is IndexExpression) { | 1200 if (node.target is IndexExpression) { |
1201 // Edge case: On a chain of [] accesses, allow splitting between them. | 1201 // Edge case: On a chain of [] accesses, allow splitting between them. |
1202 // Produces nicer output in cases like: | 1202 // Produces nicer output in cases like: |
1203 // | 1203 // |
1204 // someJson['property']['property']['property']['property']... | 1204 // someJson['property']['property']['property']['property']... |
1205 soloZeroSplit(); | 1205 soloZeroSplit(); |
1206 } | 1206 } |
1207 | 1207 |
1208 builder.startSpan(); | 1208 builder.startSpan(Cost.index); |
1209 token(node.leftBracket); | 1209 token(node.leftBracket); |
1210 soloZeroSplit(); | 1210 soloZeroSplit(); |
1211 visit(node.index); | 1211 visit(node.index); |
1212 token(node.rightBracket); | 1212 token(node.rightBracket); |
1213 builder.endSpan(); | 1213 builder.endSpan(); |
1214 } | 1214 } |
1215 | 1215 |
1216 visitInstanceCreationExpression(InstanceCreationExpression node) { | 1216 visitInstanceCreationExpression(InstanceCreationExpression node) { |
1217 builder.startSpan(); | 1217 builder.startSpan(); |
1218 token(node.keyword); | 1218 token(node.keyword); |
(...skipping 1371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2590 /// Gets the 1-based line number that the beginning of [token] lies on. | 2590 /// Gets the 1-based line number that the beginning of [token] lies on. |
2591 int _startLine(Token token) => _lineInfo.getLocation(token.offset).lineNumber; | 2591 int _startLine(Token token) => _lineInfo.getLocation(token.offset).lineNumber; |
2592 | 2592 |
2593 /// Gets the 1-based line number that the end of [token] lies on. | 2593 /// Gets the 1-based line number that the end of [token] lies on. |
2594 int _endLine(Token token) => _lineInfo.getLocation(token.end).lineNumber; | 2594 int _endLine(Token token) => _lineInfo.getLocation(token.end).lineNumber; |
2595 | 2595 |
2596 /// Gets the 1-based column number that the beginning of [token] lies on. | 2596 /// Gets the 1-based column number that the beginning of [token] lies on. |
2597 int _startColumn(Token token) => | 2597 int _startColumn(Token token) => |
2598 _lineInfo.getLocation(token.offset).columnNumber; | 2598 _lineInfo.getLocation(token.offset).columnNumber; |
2599 } | 2599 } |
OLD | NEW |