| 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 | 7 |
| 8 import 'dart:io'; | 8 import 'dart:io'; |
| 9 | 9 |
| 10 import 'package:analyzer_experimental/analyzer.dart'; | 10 import 'package:analyzer_experimental/analyzer.dart'; |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 | 139 |
| 140 /// An AST visitor that drives formatting heuristics. | 140 /// An AST visitor that drives formatting heuristics. |
| 141 class SourceVisitor implements ASTVisitor { | 141 class SourceVisitor implements ASTVisitor { |
| 142 | 142 |
| 143 /// The writer to which the source is to be written. | 143 /// The writer to which the source is to be written. |
| 144 SourceWriter writer; | 144 SourceWriter writer; |
| 145 | 145 |
| 146 /// Initialize a newly created visitor to write source code representing | 146 /// Initialize a newly created visitor to write source code representing |
| 147 /// the visited nodes to the given [writer]. | 147 /// the visited nodes to the given [writer]. |
| 148 SourceVisitor(FormatterOptions options) : | 148 SourceVisitor(FormatterOptions options) : |
| 149 writer = new SourceWriter(initialIndent: options.initialIndentationLevel, | 149 writer = new SourceWriter(indentCount: options.initialIndentationLevel, |
| 150 lineSeparator: options.lineSeparator); | 150 lineSeparator: options.lineSeparator); |
| 151 | 151 |
| 152 visitAdjacentStrings(AdjacentStrings node) { | 152 visitAdjacentStrings(AdjacentStrings node) { |
| 153 visitList(node.strings, ' '); | 153 visitList(node.strings, ' '); |
| 154 } | 154 } |
| 155 | 155 |
| 156 visitAnnotation(Annotation node) { | 156 visitAnnotation(Annotation node) { |
| 157 writer.print('@'); | 157 writer.print('@'); |
| 158 visit(node.name); | 158 visit(node.name); |
| 159 visitPrefixed('.', node.constructorName); | 159 visitPrefixed('.', node.constructorName); |
| (...skipping 776 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 936 if (i > 0) { | 936 if (i > 0) { |
| 937 writer.print(separator); | 937 writer.print(separator); |
| 938 } | 938 } |
| 939 nodes[i].accept(this); | 939 nodes[i].accept(this); |
| 940 } | 940 } |
| 941 } | 941 } |
| 942 } | 942 } |
| 943 } | 943 } |
| 944 | 944 |
| 945 } | 945 } |
| OLD | NEW |