| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 formatter_impl; | 5 library formatter_impl; |
| 6 | 6 |
| 7 import 'dart:math'; | 7 import 'dart:math'; |
| 8 | 8 |
| 9 import 'package:analyzer/analyzer.dart'; | 9 import 'package:analyzer/analyzer.dart'; |
| 10 import 'package:analyzer/src/generated/parser.dart'; | 10 import 'package:analyzer/src/generated/parser.dart'; |
| (...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 450 visit(node.condition); | 450 visit(node.condition); |
| 451 token(node.rightParenthesis); | 451 token(node.rightParenthesis); |
| 452 token(node.semicolon); | 452 token(node.semicolon); |
| 453 } | 453 } |
| 454 | 454 |
| 455 visitAssignmentExpression(AssignmentExpression node) { | 455 visitAssignmentExpression(AssignmentExpression node) { |
| 456 visit(node.leftHandSide); | 456 visit(node.leftHandSide); |
| 457 space(); | 457 space(); |
| 458 token(node.operator); | 458 token(node.operator); |
| 459 allowContinuedLines((){ | 459 allowContinuedLines((){ |
| 460 space(); | 460 levelSpace(SINGLE_SPACE_WEIGHT); |
| 461 visit(node.rightHandSide); | 461 visit(node.rightHandSide); |
| 462 }); | 462 }); |
| 463 } | 463 } |
| 464 | 464 |
| 465 @override | 465 @override |
| 466 visitAwaitExpression(AwaitExpression node) { | 466 visitAwaitExpression(AwaitExpression node) { |
| 467 token(node.awaitKeyword); | 467 token(node.awaitKeyword); |
| 468 space(); | 468 space(); |
| 469 visit(node.expression); | 469 visit(node.expression); |
| 470 // TODO(scheglov) a bug in the spec, there sould not be a ';' | 470 // TODO(scheglov) a bug in the spec, there sould not be a ';' |
| (...skipping 890 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1361 token(node.equals); | 1361 token(node.equals); |
| 1362 var initializer = node.initializer; | 1362 var initializer = node.initializer; |
| 1363 if (initializer is ListLiteral || initializer is MapLiteral) { | 1363 if (initializer is ListLiteral || initializer is MapLiteral) { |
| 1364 space(); | 1364 space(); |
| 1365 visit(initializer); | 1365 visit(initializer); |
| 1366 } else if (initializer is BinaryExpression) { | 1366 } else if (initializer is BinaryExpression) { |
| 1367 allowContinuedLines(() { | 1367 allowContinuedLines(() { |
| 1368 levelSpace(lastSpaceWeight); | 1368 levelSpace(lastSpaceWeight); |
| 1369 visit(initializer); | 1369 visit(initializer); |
| 1370 }); | 1370 }); |
| 1371 } else if (initializer is ConditionalExpression) { | |
| 1372 allowContinuedLines(() { | |
| 1373 space(); | |
| 1374 visit(initializer); | |
| 1375 }); | |
| 1376 } else { | 1371 } else { |
| 1377 allowContinuedLines(() { | 1372 allowContinuedLines(() { |
| 1378 levelSpace(lastSpaceWeight++); | 1373 levelSpace(SINGLE_SPACE_WEIGHT); |
| 1379 visit(initializer); | 1374 visit(initializer); |
| 1380 }); | 1375 }); |
| 1381 } | 1376 } |
| 1382 } | 1377 } |
| 1383 } | 1378 } |
| 1384 | 1379 |
| 1385 visitVariableDeclarationList(VariableDeclarationList node) { | 1380 visitVariableDeclarationList(VariableDeclarationList node) { |
| 1386 visitMemberMetadata(node.metadata); | 1381 visitMemberMetadata(node.metadata); |
| 1387 modifier(node.keyword); | 1382 modifier(node.keyword); |
| 1388 visitNode(node.type, followedBy: space); | 1383 visitNode(node.type, followedBy: space); |
| (...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1852 @override | 1847 @override |
| 1853 visitEnumConstantDeclaration(EnumConstantDeclaration node) { | 1848 visitEnumConstantDeclaration(EnumConstantDeclaration node) { |
| 1854 // TODO: implement visitEnumConstantDeclaration | 1849 // TODO: implement visitEnumConstantDeclaration |
| 1855 } | 1850 } |
| 1856 | 1851 |
| 1857 @override | 1852 @override |
| 1858 visitEnumDeclaration(EnumDeclaration node) { | 1853 visitEnumDeclaration(EnumDeclaration node) { |
| 1859 // TODO: implement visitEnumDeclaration | 1854 // TODO: implement visitEnumDeclaration |
| 1860 } | 1855 } |
| 1861 } | 1856 } |
| OLD | NEW |