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 764 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
775 write(node.endToken.value); | 775 write(node.endToken.value); |
776 } | 776 } |
777 | 777 |
778 visitLibraryName(LibraryName node) { | 778 visitLibraryName(LibraryName node) { |
779 addToken(node.libraryKeyword); | 779 addToken(node.libraryKeyword); |
780 node.visitChildren(this); | 780 node.visitChildren(this); |
781 write(node.getEndToken().value); | 781 write(node.getEndToken().value); |
782 newline(); | 782 newline(); |
783 } | 783 } |
784 | 784 |
| 785 visitConditionalUri(ConditionalUri node) { |
| 786 write(node.ifToken.value); |
| 787 space(); |
| 788 write('('); |
| 789 visit(node.key); |
| 790 if (node.value != null) { |
| 791 space(); |
| 792 write("=="); |
| 793 space(); |
| 794 visit(node.value); |
| 795 } |
| 796 write(")"); |
| 797 space(); |
| 798 visit(node.uri); |
| 799 } |
| 800 |
| 801 visitDottedName(DottedName node) { |
| 802 unparseNodeListOfIdentifiers(node.identifiers); |
| 803 } |
| 804 |
785 visitImport(Import node) { | 805 visitImport(Import node) { |
786 addToken(node.importKeyword); | 806 addToken(node.importKeyword); |
787 visit(node.uri); | 807 visit(node.uri); |
| 808 if (node.hasConditionalUris) { |
| 809 write(' '); |
| 810 visitNodeList(node.conditionalUris); |
| 811 } |
788 if (node.isDeferred) { | 812 if (node.isDeferred) { |
789 write(' deferred'); | 813 write(' deferred'); |
790 } | 814 } |
791 if (node.prefix != null) { | 815 if (node.prefix != null) { |
792 write(' as '); | 816 write(' as '); |
793 visit(node.prefix); | 817 visit(node.prefix); |
794 } | 818 } |
795 if (node.combinators != null) { | 819 if (node.combinators != null) { |
796 write(' '); | 820 write(' '); |
797 visit(node.combinators); | 821 visit(node.combinators); |
798 } | 822 } |
799 write(node.getEndToken().value); | 823 write(node.getEndToken().value); |
800 newline(); | 824 newline(); |
801 } | 825 } |
802 | 826 |
803 visitExport(Export node) { | 827 visitExport(Export node) { |
804 addToken(node.exportKeyword); | 828 addToken(node.exportKeyword); |
805 visit(node.uri); | 829 visit(node.uri); |
| 830 if (node.hasConditionalUris) { |
| 831 write(' '); |
| 832 visitNodeList(node.conditionalUris); |
| 833 } |
806 if (node.combinators != null) { | 834 if (node.combinators != null) { |
807 write(' '); | 835 write(' '); |
808 visit(node.combinators); | 836 visit(node.combinators); |
809 } | 837 } |
810 write(node.getEndToken().value); | 838 write(node.getEndToken().value); |
811 newline(); | 839 newline(); |
812 } | 840 } |
813 | 841 |
814 visitPart(Part node) { | 842 visitPart(Part node) { |
815 addToken(node.partKeyword); | 843 addToken(node.partKeyword); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
867 } | 895 } |
868 | 896 |
869 visitStatement(Statement node) { | 897 visitStatement(Statement node) { |
870 throw 'internal error'; // Should not be called. | 898 throw 'internal error'; // Should not be called. |
871 } | 899 } |
872 | 900 |
873 visitStringNode(StringNode node) { | 901 visitStringNode(StringNode node) { |
874 throw 'internal error'; // Should not be called. | 902 throw 'internal error'; // Should not be called. |
875 } | 903 } |
876 } | 904 } |
OLD | NEW |