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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 soloSplit(); | 154 soloSplit(); |
155 token(node.asOperator); | 155 token(node.asOperator); |
156 space(); | 156 space(); |
157 visit(node.type); | 157 visit(node.type); |
158 builder.endSpan(); | 158 builder.endSpan(); |
159 } | 159 } |
160 | 160 |
161 visitAssertStatement(AssertStatement node) { | 161 visitAssertStatement(AssertStatement node) { |
162 _simpleStatement(node, () { | 162 _simpleStatement(node, () { |
163 token(node.assertKeyword); | 163 token(node.assertKeyword); |
164 token(node.leftParenthesis); | 164 |
165 soloZeroSplit(); | 165 var arguments = [node.condition]; |
166 visit(node.condition); | 166 if (node.message != null) arguments.add(node.message); |
167 token(node.rightParenthesis); | 167 |
| 168 var visitor = new ArgumentListVisitor.forArguments( |
| 169 this, node.leftParenthesis, node.rightParenthesis, arguments); |
| 170 visitor.visit(); |
168 }); | 171 }); |
169 } | 172 } |
170 | 173 |
171 visitAssignmentExpression(AssignmentExpression node) { | 174 visitAssignmentExpression(AssignmentExpression node) { |
172 builder.nestExpression(); | 175 builder.nestExpression(); |
173 | 176 |
174 visit(node.leftHandSide); | 177 visit(node.leftHandSide); |
175 _visitAssignment(node.operator, node.rightHandSide); | 178 _visitAssignment(node.operator, node.rightHandSide); |
176 | 179 |
177 builder.unnest(); | 180 builder.unnest(); |
(...skipping 2216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2394 /// Gets the 1-based line number that the beginning of [token] lies on. | 2397 /// Gets the 1-based line number that the beginning of [token] lies on. |
2395 int _startLine(Token token) => _lineInfo.getLocation(token.offset).lineNumber; | 2398 int _startLine(Token token) => _lineInfo.getLocation(token.offset).lineNumber; |
2396 | 2399 |
2397 /// Gets the 1-based line number that the end of [token] lies on. | 2400 /// Gets the 1-based line number that the end of [token] lies on. |
2398 int _endLine(Token token) => _lineInfo.getLocation(token.end).lineNumber; | 2401 int _endLine(Token token) => _lineInfo.getLocation(token.end).lineNumber; |
2399 | 2402 |
2400 /// Gets the 1-based column number that the beginning of [token] lies on. | 2403 /// Gets the 1-based column number that the beginning of [token] lies on. |
2401 int _startColumn(Token token) => | 2404 int _startColumn(Token token) => |
2402 _lineInfo.getLocation(token.offset).columnNumber; | 2405 _lineInfo.getLocation(token.offset).columnNumber; |
2403 } | 2406 } |
OLD | NEW |