Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(831)

Side by Side Diff: src/prettyprinter.cc

Issue 9373023: Extend AST with basic module constructs (yet unused). (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addresses Jakob's comments. Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/hydrogen.cc ('k') | src/rewriter.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
85
86 void PrettyPrinter::VisitModuleVariable(ModuleVariable* node) {
87 PrintLiteral(node->var()->name(), false);
88 }
89
90
91 void PrettyPrinter::VisitModulePath(ModulePath* node) {
92 Visit(node->module());
93 Print(".");
94 PrintLiteral(node->name(), false);
95 }
96
97
98 void PrettyPrinter::VisitModuleUrl(ModuleUrl* node) {
99 Print("at ");
100 PrintLiteral(node->url(), true);
101 }
102
103
72 void PrettyPrinter::VisitExpressionStatement(ExpressionStatement* node) { 104 void PrettyPrinter::VisitExpressionStatement(ExpressionStatement* node) {
73 Visit(node->expression()); 105 Visit(node->expression());
74 Print(";"); 106 Print(";");
75 } 107 }
76 108
77 109
78 void PrettyPrinter::VisitEmptyStatement(EmptyStatement* node) { 110 void PrettyPrinter::VisitEmptyStatement(EmptyStatement* node) {
79 Print(";"); 111 Print(";");
80 } 112 }
81 113
(...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after
721 // function declarations 753 // function declarations
722 PrintIndented("FUNCTION "); 754 PrintIndented("FUNCTION ");
723 PrintLiteral(node->proxy()->name(), true); 755 PrintLiteral(node->proxy()->name(), true);
724 Print(" = function "); 756 Print(" = function ");
725 PrintLiteral(node->fun()->name(), false); 757 PrintLiteral(node->fun()->name(), false);
726 Print("\n"); 758 Print("\n");
727 } 759 }
728 } 760 }
729 761
730 762
763 void AstPrinter::VisitModuleDeclaration(ModuleDeclaration* node) {
764 IndentedScope indent(this, "MODULE");
765 PrintLiteralIndented("NAME", node->proxy()->name(), true);
766 Visit(node->module());
767 }
768
769
770 void AstPrinter::VisitModuleLiteral(ModuleLiteral* node) {
771 VisitBlock(node->body());
772 }
773
774
775 void AstPrinter::VisitModuleVariable(ModuleVariable* node) {
776 PrintLiteralIndented("VARIABLE", node->var()->name(), false);
777 }
778
779
780 void AstPrinter::VisitModulePath(ModulePath* node) {
781 IndentedScope indent(this, "PATH");
782 PrintIndentedVisit("MODULE", node->module());
783 PrintLiteralIndented("NAME", node->name(), false);
784 }
785
786
787 void AstPrinter::VisitModuleUrl(ModuleUrl* node) {
788 PrintLiteralIndented("URL", node->url(), true);
789 }
790
791
731 void AstPrinter::VisitExpressionStatement(ExpressionStatement* node) { 792 void AstPrinter::VisitExpressionStatement(ExpressionStatement* node) {
732 Visit(node->expression()); 793 Visit(node->expression());
733 } 794 }
734 795
735 796
736 void AstPrinter::VisitEmptyStatement(EmptyStatement* node) { 797 void AstPrinter::VisitEmptyStatement(EmptyStatement* node) {
737 PrintIndented("EMPTY\n"); 798 PrintIndented("EMPTY\n");
738 } 799 }
739 800
740 801
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
1014 } 1075 }
1015 1076
1016 1077
1017 void AstPrinter::VisitThisFunction(ThisFunction* node) { 1078 void AstPrinter::VisitThisFunction(ThisFunction* node) {
1018 IndentedScope indent(this, "THIS-FUNCTION"); 1079 IndentedScope indent(this, "THIS-FUNCTION");
1019 } 1080 }
1020 1081
1021 #endif // DEBUG 1082 #endif // DEBUG
1022 1083
1023 } } // namespace v8::internal 1084 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/hydrogen.cc ('k') | src/rewriter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698