Chromium Code Reviews| 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, List<String> shows: const [], |
|
jgruber1
2014/08/15 06:20:53
Types on these and suffix? :)
sigurdm
2014/08/15 13:31:42
Done.
| |
| 645 final suffix = prefix == null ? '' : ' as $prefix'; | 645 bool isDeferred: false}) { |
| 646 final suffix = (isDeferred ? ' deferred' : '') + | |
|
Johnni Winther
2014/08/15 08:07:31
Use interpolation instead of the + operator on Str
sigurdm
2014/08/15 13:31:42
Done.
| |
| 647 (prefix == null ? '' : ' as $prefix') + | |
| 648 (shows.isEmpty ? '' : ' show ${shows.join(", ")}'); | |
| 646 write('import "$uri"$suffix;'); | 649 write('import "$uri"$suffix;'); |
| 647 newline(); | 650 newline(); |
| 648 } | 651 } |
| 649 | 652 |
| 653 unparseExportTag(String uri, {List<String> shows: const []}) { | |
| 654 final suffix = shows.isEmpty ? '' : ' show ${shows.join(", ")}'; | |
| 655 write('export "$uri"$suffix;'); | |
| 656 newline(); | |
| 657 } | |
| 658 | |
| 650 visitTryStatement(TryStatement node) { | 659 visitTryStatement(TryStatement node) { |
| 651 addToken(node.tryKeyword); | 660 addToken(node.tryKeyword); |
| 652 visit(node.tryBlock); | 661 visit(node.tryBlock); |
| 653 visit(node.catchBlocks); | 662 visit(node.catchBlocks); |
| 654 if (node.finallyKeyword != null) { | 663 if (node.finallyKeyword != null) { |
| 655 space(); | 664 space(); |
| 656 addToken(node.finallyKeyword); | 665 addToken(node.finallyKeyword); |
| 657 visit(node.finallyBlock); | 666 visit(node.finallyBlock); |
| 658 } | 667 } |
| 659 } | 668 } |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 783 } | 792 } |
| 784 | 793 |
| 785 visitStatement(Statement node) { | 794 visitStatement(Statement node) { |
| 786 throw 'internal error'; // Should not be called. | 795 throw 'internal error'; // Should not be called. |
| 787 } | 796 } |
| 788 | 797 |
| 789 visitStringNode(StringNode node) { | 798 visitStringNode(StringNode node) { |
| 790 throw 'internal error'; // Should not be called. | 799 throw 'internal error'; // Should not be called. |
| 791 } | 800 } |
| 792 } | 801 } |
| OLD | NEW |