| 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 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 524 indent(); | 524 indent(); |
| 525 visitNodes(node.members, precededBy: newlines, separatedBy: newlines); | 525 visitNodes(node.members, precededBy: newlines, separatedBy: newlines); |
| 526 unindent(); | 526 unindent(); |
| 527 newlines(); | 527 newlines(); |
| 528 token(node.rightBracket); | 528 token(node.rightBracket); |
| 529 } | 529 } |
| 530 | 530 |
| 531 visitClassTypeAlias(ClassTypeAlias node) { | 531 visitClassTypeAlias(ClassTypeAlias node) { |
| 532 preserveLeadingNewlines(); | 532 preserveLeadingNewlines(); |
| 533 visitNodes(node.metadata, followedBy: newlines); | 533 visitNodes(node.metadata, followedBy: newlines); |
| 534 //TODO(pquitslund): the following _should_ work (dartbug.com/15912) | 534 modifier(node.abstractKeyword); |
| 535 //modifier(node.abstractKeyword); | |
| 536 // ... in the meantime we use this workaround | |
| 537 var prev = node.keyword.previous; | |
| 538 if (prev is KeywordToken && prev.keyword == Keyword.ABSTRACT) { | |
| 539 token(prev); | |
| 540 space(); | |
| 541 } | |
| 542 token(node.keyword); | 535 token(node.keyword); |
| 543 space(); | 536 space(); |
| 544 visit(node.name); | 537 visit(node.name); |
| 545 visit(node.typeParameters); | 538 visit(node.typeParameters); |
| 546 space(); | 539 space(); |
| 547 token(node.equals); | 540 token(node.equals); |
| 548 space(); | 541 space(); |
| 549 visit(node.superclass); | 542 visit(node.superclass); |
| 550 visitNode(node.withClause, precededBy: space); | 543 visitNode(node.withClause, precededBy: space); |
| 551 visitNode(node.implementsClause, precededBy: space); | 544 visitNode(node.implementsClause, precededBy: space); |
| (...skipping 1146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1698 var lastLine = | 1691 var lastLine = |
| 1699 lineInfo.getLocation(lastOffset).lineNumber; | 1692 lineInfo.getLocation(lastOffset).lineNumber; |
| 1700 var currentLine = | 1693 var currentLine = |
| 1701 lineInfo.getLocation(currentOffset).lineNumber; | 1694 lineInfo.getLocation(currentOffset).lineNumber; |
| 1702 return currentLine - lastLine; | 1695 return currentLine - lastLine; |
| 1703 } | 1696 } |
| 1704 | 1697 |
| 1705 String toString() => writer.toString(); | 1698 String toString() => writer.toString(); |
| 1706 | 1699 |
| 1707 } | 1700 } |
| OLD | NEW |