| 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 906 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 917 token(node.leftParenthesis); | 917 token(node.leftParenthesis); |
| 918 visit(node.condition); | 918 visit(node.condition); |
| 919 token(node.rightParenthesis); | 919 token(node.rightParenthesis); |
| 920 }); | 920 }); |
| 921 space(); | 921 space(); |
| 922 if (hasElse) { | 922 if (hasElse) { |
| 923 printAsBlock(node.thenStatement); | 923 printAsBlock(node.thenStatement); |
| 924 space(); | 924 space(); |
| 925 token(node.elseKeyword); | 925 token(node.elseKeyword); |
| 926 space(); | 926 space(); |
| 927 printAsBlock(node.elseStatement); | 927 if (node.elseStatement is IfStatement) { |
| 928 visit(node.elseStatement); |
| 929 } else { |
| 930 printAsBlock(node.elseStatement); |
| 931 } |
| 928 } else { | 932 } else { |
| 929 visit(node.thenStatement); | 933 visit(node.thenStatement); |
| 930 } | 934 } |
| 931 } | 935 } |
| 932 | 936 |
| 933 visitImplementsClause(ImplementsClause node) { | 937 visitImplementsClause(ImplementsClause node) { |
| 934 token(node.keyword); | 938 token(node.keyword); |
| 935 space(); | 939 space(); |
| 936 visitCommaSeparatedNodes(node.interfaces); | 940 visitCommaSeparatedNodes(node.interfaces); |
| 937 } | 941 } |
| (...skipping 811 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1749 var lastLine = | 1753 var lastLine = |
| 1750 lineInfo.getLocation(lastOffset).lineNumber; | 1754 lineInfo.getLocation(lastOffset).lineNumber; |
| 1751 var currentLine = | 1755 var currentLine = |
| 1752 lineInfo.getLocation(currentOffset).lineNumber; | 1756 lineInfo.getLocation(currentOffset).lineNumber; |
| 1753 return currentLine - lastLine; | 1757 return currentLine - lastLine; |
| 1754 } | 1758 } |
| 1755 | 1759 |
| 1756 String toString() => writer.toString(); | 1760 String toString() => writer.toString(); |
| 1757 | 1761 |
| 1758 } | 1762 } |
| OLD | NEW |