OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 part of tree; | 5 part of tree; |
6 | 6 |
7 String unparse(Node node, {minify: true}) { | 7 String unparse(Node node, {minify: true}) { |
8 Unparser unparser = new Unparser(minify: minify); | 8 Unparser unparser = new Unparser(minify: minify); |
9 unparser.unparse(node); | 9 unparser.unparse(node); |
10 return unparser.result; | 10 return unparser.result; |
(...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
634 newline(); | 634 newline(); |
635 indentMore(); | 635 indentMore(); |
636 visit(node.labelsAndCases); | 636 visit(node.labelsAndCases); |
637 if (node.isDefaultCase) { | 637 if (node.isDefaultCase) { |
638 write('default:'); | 638 write('default:'); |
639 } | 639 } |
640 unparseBlockStatements(node.statements); | 640 unparseBlockStatements(node.statements); |
641 indentLess(); | 641 indentLess(); |
642 } | 642 } |
643 | 643 |
644 unparseImportTag(String uri, [String prefix]) { | 644 unparseImportTag(String uri, {String prefix, |
645 final suffix = prefix == null ? '' : ' as $prefix'; | 645 List<String> shows: const <String>[], |
646 write('import "$uri"$suffix;'); | 646 bool isDeferred: false}) { |
| 647 String deferredString = isDeferred ? ' deferred' : ''; |
| 648 String prefixString = prefix == null ? '' : ' as $prefix'; |
| 649 String showString = shows.isEmpty ? '' : ' show ${shows.join(", ")}'; |
| 650 write('import "$uri"$deferredString$prefixString$showString;'); |
647 newline(); | 651 newline(); |
648 } | 652 } |
649 | 653 |
| 654 unparseExportTag(String uri, {List<String> shows: const []}) { |
| 655 String suffix = shows.isEmpty ? '' : ' show ${shows.join(", ")}'; |
| 656 write('export "$uri"$suffix;'); |
| 657 newline(); |
| 658 } |
| 659 |
650 visitTryStatement(TryStatement node) { | 660 visitTryStatement(TryStatement node) { |
651 addToken(node.tryKeyword); | 661 addToken(node.tryKeyword); |
652 visit(node.tryBlock); | 662 visit(node.tryBlock); |
653 visit(node.catchBlocks); | 663 visit(node.catchBlocks); |
654 if (node.finallyKeyword != null) { | 664 if (node.finallyKeyword != null) { |
655 space(); | 665 space(); |
656 addToken(node.finallyKeyword); | 666 addToken(node.finallyKeyword); |
657 visit(node.finallyBlock); | 667 visit(node.finallyBlock); |
658 } | 668 } |
659 } | 669 } |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
783 } | 793 } |
784 | 794 |
785 visitStatement(Statement node) { | 795 visitStatement(Statement node) { |
786 throw 'internal error'; // Should not be called. | 796 throw 'internal error'; // Should not be called. |
787 } | 797 } |
788 | 798 |
789 visitStringNode(StringNode node) { | 799 visitStringNode(StringNode node) { |
790 throw 'internal error'; // Should not be called. | 800 throw 'internal error'; // Should not be called. |
791 } | 801 } |
792 } | 802 } |
OLD | NEW |