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