| 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 752 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 763 visitEmptyFunctionBody(EmptyFunctionBody node) { | 763 visitEmptyFunctionBody(EmptyFunctionBody node) { |
| 764 token(node.semicolon); | 764 token(node.semicolon); |
| 765 } | 765 } |
| 766 | 766 |
| 767 visitEmptyStatement(EmptyStatement node) { | 767 visitEmptyStatement(EmptyStatement node) { |
| 768 if (!codeTransforms || node.parent is! Block) { | 768 if (!codeTransforms || node.parent is! Block) { |
| 769 token(node.semicolon); | 769 token(node.semicolon); |
| 770 } | 770 } |
| 771 } | 771 } |
| 772 | 772 |
| 773 visitEnumConstantDeclaration(EnumConstantDeclaration node){ |
| 774 visit(node.name); |
| 775 } |
| 776 |
| 777 visitEnumDeclaration(EnumDeclaration node){ |
| 778 visitMemberMetadata(node.metadata); |
| 779 token(node.keyword); |
| 780 space(); |
| 781 visit(node.name); |
| 782 space(); |
| 783 token(node.leftBracket); |
| 784 newlines(); |
| 785 indent(); |
| 786 visitCommaSeparatedNodes(node.constants); |
| 787 newlines(); |
| 788 token(node.rightBracket, precededBy: unindent); |
| 789 } |
| 790 |
| 773 visitExportDirective(ExportDirective node) { | 791 visitExportDirective(ExportDirective node) { |
| 774 visitDirectiveMetadata(node.metadata); | 792 visitDirectiveMetadata(node.metadata); |
| 775 token(node.keyword); | 793 token(node.keyword); |
| 776 space(); | 794 space(); |
| 777 visit(node.uri); | 795 visit(node.uri); |
| 778 allowContinuedLines((){ | 796 allowContinuedLines((){ |
| 779 visitNodes(node.combinators, precededBy: space, separatedBy: space); | 797 visitNodes(node.combinators, precededBy: space, separatedBy: space); |
| 780 }); | 798 }); |
| 781 token(node.semicolon); | 799 token(node.semicolon); |
| 782 } | 800 } |
| (...skipping 1051 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1834 /// Count the lines between two offsets. | 1852 /// Count the lines between two offsets. |
| 1835 int linesBetween(int lastOffset, int currentOffset) { | 1853 int linesBetween(int lastOffset, int currentOffset) { |
| 1836 var lastLine = | 1854 var lastLine = |
| 1837 lineInfo.getLocation(lastOffset).lineNumber; | 1855 lineInfo.getLocation(lastOffset).lineNumber; |
| 1838 var currentLine = | 1856 var currentLine = |
| 1839 lineInfo.getLocation(currentOffset).lineNumber; | 1857 lineInfo.getLocation(currentOffset).lineNumber; |
| 1840 return currentLine - lastLine; | 1858 return currentLine - lastLine; |
| 1841 } | 1859 } |
| 1842 | 1860 |
| 1843 String toString() => writer.toString(); | 1861 String toString() => writer.toString(); |
| 1844 | |
| 1845 @override | |
| 1846 visitEnumConstantDeclaration(EnumConstantDeclaration node) { | |
| 1847 // TODO: implement visitEnumConstantDeclaration | |
| 1848 } | |
| 1849 | |
| 1850 @override | |
| 1851 visitEnumDeclaration(EnumDeclaration node) { | |
| 1852 // TODO: implement visitEnumDeclaration | |
| 1853 } | |
| 1854 } | 1862 } |
| OLD | NEW |