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 1133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1144 // var generic = < T,S >(){}; | 1144 // var generic = < T,S >(){}; |
1145 // } | 1145 // } |
1146 // <<< | 1146 // <<< |
1147 // main() { | 1147 // main() { |
1148 // var generic = <T, S>() {}; | 1148 // var generic = <T, S>() {}; |
1149 // } | 1149 // } |
1150 _visitBody(node.typeParameters, node.parameters, node.body); | 1150 _visitBody(node.typeParameters, node.parameters, node.body); |
1151 } | 1151 } |
1152 | 1152 |
1153 visitFunctionExpressionInvocation(FunctionExpressionInvocation node) { | 1153 visitFunctionExpressionInvocation(FunctionExpressionInvocation node) { |
| 1154 // Try to keep the entire invocation one line. |
| 1155 builder.startSpan(); |
| 1156 builder.nestExpression(); |
| 1157 |
1154 visit(node.function); | 1158 visit(node.function); |
1155 visit(node.argumentList); | 1159 visit(node.typeArguments); |
| 1160 visitArgumentList(node.argumentList, nestExpression: false); |
| 1161 |
| 1162 builder.unnest(); |
| 1163 builder.endSpan(); |
1156 } | 1164 } |
1157 | 1165 |
1158 visitFunctionTypeAlias(FunctionTypeAlias node) { | 1166 visitFunctionTypeAlias(FunctionTypeAlias node) { |
1159 visitMetadata(node.metadata); | 1167 visitMetadata(node.metadata); |
1160 | 1168 |
1161 _simpleStatement(node, () { | 1169 _simpleStatement(node, () { |
1162 token(node.typedefKeyword); | 1170 token(node.typedefKeyword); |
1163 space(); | 1171 space(); |
1164 visit(node.returnType, after: space); | 1172 visit(node.returnType, after: space); |
1165 visit(node.name); | 1173 visit(node.name); |
(...skipping 1605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2771 /// Gets the 1-based line number that the beginning of [token] lies on. | 2779 /// Gets the 1-based line number that the beginning of [token] lies on. |
2772 int _startLine(Token token) => _lineInfo.getLocation(token.offset).lineNumber; | 2780 int _startLine(Token token) => _lineInfo.getLocation(token.offset).lineNumber; |
2773 | 2781 |
2774 /// Gets the 1-based line number that the end of [token] lies on. | 2782 /// Gets the 1-based line number that the end of [token] lies on. |
2775 int _endLine(Token token) => _lineInfo.getLocation(token.end).lineNumber; | 2783 int _endLine(Token token) => _lineInfo.getLocation(token.end).lineNumber; |
2776 | 2784 |
2777 /// Gets the 1-based column number that the beginning of [token] lies on. | 2785 /// Gets the 1-based column number that the beginning of [token] lies on. |
2778 int _startColumn(Token token) => | 2786 int _startColumn(Token token) => |
2779 _lineInfo.getLocation(token.offset).columnNumber; | 2787 _lineInfo.getLocation(token.offset).columnNumber; |
2780 } | 2788 } |
OLD | NEW |