| 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'; | |
| 9 | |
| 10 import 'package:analyzer_experimental/analyzer.dart'; | 8 import 'package:analyzer_experimental/analyzer.dart'; |
| 11 import 'package:analyzer_experimental/src/generated/parser.dart'; | 9 import 'package:analyzer_experimental/src/generated/parser.dart'; |
| 12 import 'package:analyzer_experimental/src/generated/scanner.dart'; | 10 import 'package:analyzer_experimental/src/generated/scanner.dart'; |
| 13 import 'package:analyzer_experimental/src/generated/source.dart'; | 11 import 'package:analyzer_experimental/src/generated/source.dart'; |
| 14 import 'package:analyzer_experimental/src/services/writer.dart'; | 12 import 'package:analyzer_experimental/src/services/writer.dart'; |
| 15 | 13 |
| 16 /// OS line separator. --- TODO(pquitslund): may not be necessary | 14 /// OS line separator. --- TODO(pquitslund): may not be necessary |
| 17 const NEW_LINE = '\n' ; //Platform.pathSeparator; | 15 const NEW_LINE = '\n' ; //Platform.pathSeparator; |
| 18 | 16 |
| 19 /// Formatter options. | 17 /// Formatter options. |
| (...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 529 visit(node.uri); | 527 visit(node.uri); |
| 530 visitPrefixed(' as ', node.prefix); | 528 visitPrefixed(' as ', node.prefix); |
| 531 visitPrefixedList(' ', node.combinators, ' '); | 529 visitPrefixedList(' ', node.combinators, ' '); |
| 532 writer.print(';'); | 530 writer.print(';'); |
| 533 } | 531 } |
| 534 | 532 |
| 535 visitIndexExpression(IndexExpression node) { | 533 visitIndexExpression(IndexExpression node) { |
| 536 if (node.isCascaded) { | 534 if (node.isCascaded) { |
| 537 writer.print('..'); | 535 writer.print('..'); |
| 538 } else { | 536 } else { |
| 539 visit(node.array); | 537 visit(node.target); |
| 540 } | 538 } |
| 541 writer.print('['); | 539 writer.print('['); |
| 542 visit(node.index); | 540 visit(node.index); |
| 543 writer.print(']'); | 541 writer.print(']'); |
| 544 } | 542 } |
| 545 | 543 |
| 546 visitInstanceCreationExpression(InstanceCreationExpression node) { | 544 visitInstanceCreationExpression(InstanceCreationExpression node) { |
| 547 visitToken(node.keyword, ' '); | 545 visitToken(node.keyword, ' '); |
| 548 visit(node.constructorName); | 546 visit(node.constructorName); |
| 549 visit(node.argumentList); | 547 visit(node.argumentList); |
| (...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 974 writer.newline(); | 972 writer.newline(); |
| 975 } | 973 } |
| 976 } | 974 } |
| 977 nodes[i].accept(this); | 975 nodes[i].accept(this); |
| 978 } | 976 } |
| 979 } | 977 } |
| 980 } | 978 } |
| 981 } | 979 } |
| 982 | 980 |
| 983 } | 981 } |
| OLD | NEW |