| 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 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 364 } | 364 } |
| 365 | 365 |
| 366 visitNodes(directives, between: oneOrTwoNewlines); | 366 visitNodes(directives, between: oneOrTwoNewlines); |
| 367 visitNodes(node.declarations, | 367 visitNodes(node.declarations, |
| 368 before: twoNewlines, between: oneOrTwoNewlines); | 368 before: twoNewlines, between: oneOrTwoNewlines); |
| 369 } | 369 } |
| 370 | 370 |
| 371 visitConditionalExpression(ConditionalExpression node) { | 371 visitConditionalExpression(ConditionalExpression node) { |
| 372 _writer.nestExpression(); | 372 _writer.nestExpression(); |
| 373 visit(node.condition); | 373 visit(node.condition); |
| 374 space(); | |
| 375 | 374 |
| 376 _writer.startSpan(); | 375 _writer.startSpan(); |
| 377 token(node.question); | |
| 378 | 376 |
| 379 // If we split after one clause in a conditional, always split after both. | 377 // If we split after one clause in a conditional, always split after both. |
| 380 _writer.startMultisplit(); | 378 _writer.startMultisplit(); |
| 381 _writer.multisplit(nest: true, space: true); | 379 _writer.multisplit(nest: true, space: true); |
| 380 token(node.question); |
| 381 space(); |
| 382 |
| 382 visit(node.thenExpression); | 383 visit(node.thenExpression); |
| 383 | 384 |
| 385 _writer.multisplit(nest: true, space: true); |
| 386 token(node.colon); |
| 384 space(); | 387 space(); |
| 385 token(node.colon); | 388 |
| 386 _writer.multisplit(nest: true, space: true); | |
| 387 visit(node.elseExpression); | 389 visit(node.elseExpression); |
| 388 | 390 |
| 389 _writer.endMultisplit(); | 391 _writer.endMultisplit(); |
| 390 _writer.endSpan(); | 392 _writer.endSpan(); |
| 391 _writer.unnest(); | 393 _writer.unnest(); |
| 392 } | 394 } |
| 393 | 395 |
| 394 visitConstructorDeclaration(ConstructorDeclaration node) { | 396 visitConstructorDeclaration(ConstructorDeclaration node) { |
| 395 visitMemberMetadata(node.metadata); | 397 visitMemberMetadata(node.metadata); |
| 396 | 398 |
| (...skipping 1406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1803 /// Gets the 1-based line number that the beginning of [token] lies on. | 1805 /// Gets the 1-based line number that the beginning of [token] lies on. |
| 1804 int _startLine(Token token) => _lineInfo.getLocation(token.offset).lineNumber; | 1806 int _startLine(Token token) => _lineInfo.getLocation(token.offset).lineNumber; |
| 1805 | 1807 |
| 1806 /// Gets the 1-based line number that the end of [token] lies on. | 1808 /// Gets the 1-based line number that the end of [token] lies on. |
| 1807 int _endLine(Token token) => _lineInfo.getLocation(token.end).lineNumber; | 1809 int _endLine(Token token) => _lineInfo.getLocation(token.end).lineNumber; |
| 1808 | 1810 |
| 1809 /// Gets the 1-based column number that the beginning of [token] lies on. | 1811 /// Gets the 1-based column number that the beginning of [token] lies on. |
| 1810 int _startColumn(Token token) => | 1812 int _startColumn(Token token) => |
| 1811 _lineInfo.getLocation(token.offset).columnNumber; | 1813 _lineInfo.getLocation(token.offset).columnNumber; |
| 1812 } | 1814 } |
| OLD | NEW |