| 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 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 500 if (!node.statements.isEmpty) { | 500 if (!node.statements.isEmpty) { |
| 501 visitNodes(node.statements, precededBy: newlines, separatedBy: newlines); | 501 visitNodes(node.statements, precededBy: newlines, separatedBy: newlines); |
| 502 newlines(); | 502 newlines(); |
| 503 } else { | 503 } else { |
| 504 preserveLeadingNewlines(); | 504 preserveLeadingNewlines(); |
| 505 } | 505 } |
| 506 token(node.rightBracket, precededBy: unindent); | 506 token(node.rightBracket, precededBy: unindent); |
| 507 } | 507 } |
| 508 | 508 |
| 509 visitBlockFunctionBody(BlockFunctionBody node) { | 509 visitBlockFunctionBody(BlockFunctionBody node) { |
| 510 token(node.keyword, followedBy: nonBreakingSpace); |
| 510 visit(node.block); | 511 visit(node.block); |
| 511 } | 512 } |
| 512 | 513 |
| 513 visitBooleanLiteral(BooleanLiteral node) { | 514 visitBooleanLiteral(BooleanLiteral node) { |
| 514 token(node.literal); | 515 token(node.literal); |
| 515 } | 516 } |
| 516 | 517 |
| 517 visitBreakStatement(BreakStatement node) { | 518 visitBreakStatement(BreakStatement node) { |
| 518 token(node.keyword); | 519 token(node.keyword); |
| 519 visitNode(node.label, precededBy: space); | 520 visitNode(node.label, precededBy: space); |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 775 space(); | 776 space(); |
| 776 visit(node.uri); | 777 visit(node.uri); |
| 777 allowContinuedLines((){ | 778 allowContinuedLines((){ |
| 778 visitNodes(node.combinators, precededBy: space, separatedBy: space); | 779 visitNodes(node.combinators, precededBy: space, separatedBy: space); |
| 779 }); | 780 }); |
| 780 token(node.semicolon); | 781 token(node.semicolon); |
| 781 } | 782 } |
| 782 | 783 |
| 783 visitExpressionFunctionBody(ExpressionFunctionBody node) { | 784 visitExpressionFunctionBody(ExpressionFunctionBody node) { |
| 784 int weight = lastSpaceWeight++; | 785 int weight = lastSpaceWeight++; |
| 786 token(node.keyword, followedBy: nonBreakingSpace); |
| 785 token(node.functionDefinition); | 787 token(node.functionDefinition); |
| 786 levelSpace(weight); | 788 levelSpace(weight); |
| 787 visit(node.expression); | 789 visit(node.expression); |
| 788 token(node.semicolon); | 790 token(node.semicolon); |
| 789 } | 791 } |
| 790 | 792 |
| 791 visitExpressionStatement(ExpressionStatement node) { | 793 visitExpressionStatement(ExpressionStatement node) { |
| 792 visit(node.expression); | 794 visit(node.expression); |
| 793 token(node.semicolon); | 795 token(node.semicolon); |
| 794 } | 796 } |
| (...skipping 1048 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1843 @override | 1845 @override |
| 1844 visitEnumConstantDeclaration(EnumConstantDeclaration node) { | 1846 visitEnumConstantDeclaration(EnumConstantDeclaration node) { |
| 1845 // TODO: implement visitEnumConstantDeclaration | 1847 // TODO: implement visitEnumConstantDeclaration |
| 1846 } | 1848 } |
| 1847 | 1849 |
| 1848 @override | 1850 @override |
| 1849 visitEnumDeclaration(EnumDeclaration node) { | 1851 visitEnumDeclaration(EnumDeclaration node) { |
| 1850 // TODO: implement visitEnumDeclaration | 1852 // TODO: implement visitEnumDeclaration |
| 1851 } | 1853 } |
| 1852 } | 1854 } |
| OLD | NEW |