OLD | NEW |
---|---|
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
62 Print("var "); | 62 Print("var "); |
63 PrintLiteral(node->proxy()->name(), false); | 63 PrintLiteral(node->proxy()->name(), false); |
64 if (node->fun() != NULL) { | 64 if (node->fun() != NULL) { |
65 Print(" = "); | 65 Print(" = "); |
66 PrintFunctionLiteral(node->fun()); | 66 PrintFunctionLiteral(node->fun()); |
67 } | 67 } |
68 Print(";"); | 68 Print(";"); |
69 } | 69 } |
70 | 70 |
71 | 71 |
72 void PrettyPrinter::VisitModuleDeclaration(ModuleDeclaration* node) { | |
73 Print("module "); | |
74 PrintLiteral(node->proxy()->name(), false); | |
75 Print(" = "); | |
76 Visit(node->module()); | |
77 Print(";"); | |
78 } | |
79 | |
80 | |
81 void PrettyPrinter::VisitModuleLiteral(ModuleLiteral* node) { | |
82 VisitBlock(node->body()); | |
83 } | |
84 | |
Jakob Kummerow
2012/02/09 13:18:35
nit: two empty lines
rossberg
2012/02/09 13:26:31
Done.
| |
85 void PrettyPrinter::VisitModuleVariable(ModuleVariable* node) { | |
86 PrintLiteral(node->var()->name(), false); | |
87 } | |
88 | |
89 void PrettyPrinter::VisitModulePath(ModulePath* node) { | |
90 Visit(node->module()); | |
91 Print("."); | |
92 PrintLiteral(node->name(), false); | |
93 } | |
94 | |
95 void PrettyPrinter::VisitModuleUrl(ModuleUrl* node) { | |
96 Print("at "); | |
97 PrintLiteral(node->url(), true); | |
98 } | |
99 | |
100 | |
72 void PrettyPrinter::VisitExpressionStatement(ExpressionStatement* node) { | 101 void PrettyPrinter::VisitExpressionStatement(ExpressionStatement* node) { |
73 Visit(node->expression()); | 102 Visit(node->expression()); |
74 Print(";"); | 103 Print(";"); |
75 } | 104 } |
76 | 105 |
77 | 106 |
78 void PrettyPrinter::VisitEmptyStatement(EmptyStatement* node) { | 107 void PrettyPrinter::VisitEmptyStatement(EmptyStatement* node) { |
79 Print(";"); | 108 Print(";"); |
80 } | 109 } |
81 | 110 |
(...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
721 // function declarations | 750 // function declarations |
722 PrintIndented("FUNCTION "); | 751 PrintIndented("FUNCTION "); |
723 PrintLiteral(node->proxy()->name(), true); | 752 PrintLiteral(node->proxy()->name(), true); |
724 Print(" = function "); | 753 Print(" = function "); |
725 PrintLiteral(node->fun()->name(), false); | 754 PrintLiteral(node->fun()->name(), false); |
726 Print("\n"); | 755 Print("\n"); |
727 } | 756 } |
728 } | 757 } |
729 | 758 |
730 | 759 |
760 void AstPrinter::VisitModuleDeclaration(ModuleDeclaration* node) { | |
761 IndentedScope indent(this, "MODULE"); | |
762 PrintLiteralIndented("NAME", node->proxy()->name(), true); | |
763 Visit(node->module()); | |
764 } | |
765 | |
766 | |
767 void AstPrinter::VisitModuleLiteral(ModuleLiteral* node) { | |
768 VisitBlock(node->body()); | |
769 } | |
770 | |
Jakob Kummerow
2012/02/09 13:18:35
same here
rossberg
2012/02/09 13:26:31
Done.
| |
771 void AstPrinter::VisitModuleVariable(ModuleVariable* node) { | |
772 PrintLiteralIndented("VARIABLE", node->var()->name(), false); | |
773 } | |
774 | |
775 void AstPrinter::VisitModulePath(ModulePath* node) { | |
776 IndentedScope indent(this, "PATH"); | |
777 PrintIndentedVisit("MODULE", node->module()); | |
778 PrintLiteralIndented("NAME", node->name(), false); | |
779 } | |
780 | |
781 void AstPrinter::VisitModuleUrl(ModuleUrl* node) { | |
782 PrintLiteralIndented("URL", node->url(), true); | |
783 } | |
784 | |
785 | |
731 void AstPrinter::VisitExpressionStatement(ExpressionStatement* node) { | 786 void AstPrinter::VisitExpressionStatement(ExpressionStatement* node) { |
732 Visit(node->expression()); | 787 Visit(node->expression()); |
733 } | 788 } |
734 | 789 |
735 | 790 |
736 void AstPrinter::VisitEmptyStatement(EmptyStatement* node) { | 791 void AstPrinter::VisitEmptyStatement(EmptyStatement* node) { |
737 PrintIndented("EMPTY\n"); | 792 PrintIndented("EMPTY\n"); |
738 } | 793 } |
739 | 794 |
740 | 795 |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1014 } | 1069 } |
1015 | 1070 |
1016 | 1071 |
1017 void AstPrinter::VisitThisFunction(ThisFunction* node) { | 1072 void AstPrinter::VisitThisFunction(ThisFunction* node) { |
1018 IndentedScope indent(this, "THIS-FUNCTION"); | 1073 IndentedScope indent(this, "THIS-FUNCTION"); |
1019 } | 1074 } |
1020 | 1075 |
1021 #endif // DEBUG | 1076 #endif // DEBUG |
1022 | 1077 |
1023 } } // namespace v8::internal | 1078 } } // namespace v8::internal |
OLD | NEW |