| 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 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 509 }); | 509 }); |
| 510 token(node.leftBracket); | 510 token(node.leftBracket); |
| 511 indent(); | 511 indent(); |
| 512 visitNodes(node.members, precededBy: newlines, separatedBy: newlines); | 512 visitNodes(node.members, precededBy: newlines, separatedBy: newlines); |
| 513 unindent(); | 513 unindent(); |
| 514 newlines(); | 514 newlines(); |
| 515 token(node.rightBracket); | 515 token(node.rightBracket); |
| 516 } | 516 } |
| 517 | 517 |
| 518 visitClassTypeAlias(ClassTypeAlias node) { | 518 visitClassTypeAlias(ClassTypeAlias node) { |
| 519 preserveLeadingNewlines(); |
| 520 //TODO(pquitslund): the following _should_ work (dartbug.com/15912) |
| 521 //modifier(node.abstractKeyword); |
| 522 // ... in the meantime we use this workaround |
| 523 var prev = node.keyword.previous; |
| 524 if (prev.keyword == Keyword.ABSTRACT) { |
| 525 token(prev); |
| 526 space(); |
| 527 } |
| 519 token(node.keyword); | 528 token(node.keyword); |
| 520 space(); | 529 space(); |
| 521 visit(node.name); | 530 visit(node.name); |
| 522 visit(node.typeParameters); | 531 visit(node.typeParameters); |
| 523 space(); | 532 space(); |
| 524 token(node.equals); | 533 token(node.equals); |
| 525 space(); | 534 space(); |
| 526 if (node.abstractKeyword != null) { | |
| 527 token(node.abstractKeyword); | |
| 528 space(); | |
| 529 } | |
| 530 visit(node.superclass); | 535 visit(node.superclass); |
| 531 visitNode(node.withClause, precededBy: space); | 536 visitNode(node.withClause, precededBy: space); |
| 532 visitNode(node.implementsClause, precededBy: space); | 537 visitNode(node.implementsClause, precededBy: space); |
| 533 token(node.semicolon); | 538 token(node.semicolon); |
| 534 } | 539 } |
| 535 | 540 |
| 536 visitComment(Comment node) => null; | 541 visitComment(Comment node) => null; |
| 537 | 542 |
| 538 visitCommentReference(CommentReference node) => null; | 543 visitCommentReference(CommentReference node) => null; |
| 539 | 544 |
| (...skipping 1088 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1628 var lastLine = | 1633 var lastLine = |
| 1629 lineInfo.getLocation(lastOffset).lineNumber; | 1634 lineInfo.getLocation(lastOffset).lineNumber; |
| 1630 var currentLine = | 1635 var currentLine = |
| 1631 lineInfo.getLocation(currentOffset).lineNumber; | 1636 lineInfo.getLocation(currentOffset).lineNumber; |
| 1632 return currentLine - lastLine; | 1637 return currentLine - lastLine; |
| 1633 } | 1638 } |
| 1634 | 1639 |
| 1635 String toString() => writer.toString(); | 1640 String toString() => writer.toString(); |
| 1636 | 1641 |
| 1637 } | 1642 } |
| OLD | NEW |