| 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 632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 643 } | 643 } |
| 644 | 644 |
| 645 visitPrefixedBody(space, body); | 645 visitPrefixedBody(space, body); |
| 646 } | 646 } |
| 647 | 647 |
| 648 visitConstructorInitializers(ConstructorDeclaration node) { | 648 visitConstructorInitializers(ConstructorDeclaration node) { |
| 649 if (node.initializers.length > 1) { | 649 if (node.initializers.length > 1) { |
| 650 newlines(); | 650 newlines(); |
| 651 } else { | 651 } else { |
| 652 preserveLeadingNewlines(); | 652 preserveLeadingNewlines(); |
| 653 space(); |
| 653 } | 654 } |
| 654 indent(2); | 655 indent(2); |
| 655 token(node.separator /* : */); | 656 token(node.separator /* : */); |
| 656 space(); | 657 space(); |
| 657 for (var i = 0; i < node.initializers.length; i++) { | 658 for (var i = 0; i < node.initializers.length; i++) { |
| 658 if (i > 0) { | 659 if (i > 0) { |
| 659 // preceding comma | 660 // preceding comma |
| 660 token(node.initializers[i].beginToken.previous); | 661 token(node.initializers[i].beginToken.previous); |
| 661 newlines(); | 662 newlines(); |
| 662 space(n: 2, allowLineLeading: true); | 663 space(n: 2, allowLineLeading: true); |
| (...skipping 1090 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1753 var lastLine = | 1754 var lastLine = |
| 1754 lineInfo.getLocation(lastOffset).lineNumber; | 1755 lineInfo.getLocation(lastOffset).lineNumber; |
| 1755 var currentLine = | 1756 var currentLine = |
| 1756 lineInfo.getLocation(currentOffset).lineNumber; | 1757 lineInfo.getLocation(currentOffset).lineNumber; |
| 1757 return currentLine - lastLine; | 1758 return currentLine - lastLine; |
| 1758 } | 1759 } |
| 1759 | 1760 |
| 1760 String toString() => writer.toString(); | 1761 String toString() => writer.toString(); |
| 1761 | 1762 |
| 1762 } | 1763 } |
| OLD | NEW |