| 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/java_core.dart' show CharSequence; | 10 import 'package:analyzer/src/generated/java_core.dart' show CharSequence; |
| (...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 /// Post format selection information. | 381 /// Post format selection information. |
| 382 Selection selection; | 382 Selection selection; |
| 383 | 383 |
| 384 | 384 |
| 385 /// Initialize a newly created visitor to write source code representing | 385 /// Initialize a newly created visitor to write source code representing |
| 386 /// the visited nodes to the given [writer]. | 386 /// the visited nodes to the given [writer]. |
| 387 SourceVisitor(FormatterOptions options, this.lineInfo, this.source, | 387 SourceVisitor(FormatterOptions options, this.lineInfo, this.source, |
| 388 this.preSelection) | 388 this.preSelection) |
| 389 : writer = new SourceWriter(indentCount: options.initialIndentationLevel, | 389 : writer = new SourceWriter(indentCount: options.initialIndentationLevel, |
| 390 lineSeparator: options.lineSeparator, | 390 lineSeparator: options.lineSeparator, |
| 391 maxLineLength: options.pageWidth, |
| 391 useTabs: options.tabsForIndent, | 392 useTabs: options.tabsForIndent, |
| 392 spacesPerIndent: options.spacesPerIndent), | 393 spacesPerIndent: options.spacesPerIndent), |
| 393 codeTransforms = options.codeTransforms; | 394 codeTransforms = options.codeTransforms; |
| 394 | 395 |
| 395 visitAdjacentStrings(AdjacentStrings node) { | 396 visitAdjacentStrings(AdjacentStrings node) { |
| 396 visitNodes(node.strings, separatedBy: space); | 397 visitNodes(node.strings, separatedBy: space); |
| 397 } | 398 } |
| 398 | 399 |
| 399 visitAnnotation(Annotation node) { | 400 visitAnnotation(Annotation node) { |
| 400 token(node.atSign); | 401 token(node.atSign); |
| (...skipping 1297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1698 var lastLine = | 1699 var lastLine = |
| 1699 lineInfo.getLocation(lastOffset).lineNumber; | 1700 lineInfo.getLocation(lastOffset).lineNumber; |
| 1700 var currentLine = | 1701 var currentLine = |
| 1701 lineInfo.getLocation(currentOffset).lineNumber; | 1702 lineInfo.getLocation(currentOffset).lineNumber; |
| 1702 return currentLine - lastLine; | 1703 return currentLine - lastLine; |
| 1703 } | 1704 } |
| 1704 | 1705 |
| 1705 String toString() => writer.toString(); | 1706 String toString() => writer.toString(); |
| 1706 | 1707 |
| 1707 } | 1708 } |
| OLD | NEW |