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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/hydrogen.cc ('k') | src/rewriter.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/prettyprinter.cc
diff --git a/src/prettyprinter.cc b/src/prettyprinter.cc
index d940704973ac788df3f3c55b0fbc3fe115f24f3f..685e443e243584bb032ee7682cf83ee6a68fd274 100644
--- a/src/prettyprinter.cc
+++ b/src/prettyprinter.cc
@@ -69,6 +69,38 @@ void PrettyPrinter::VisitVariableDeclaration(VariableDeclaration* node) {
}
+void PrettyPrinter::VisitModuleDeclaration(ModuleDeclaration* node) {
+ Print("module ");
+ PrintLiteral(node->proxy()->name(), false);
+ Print(" = ");
+ Visit(node->module());
+ Print(";");
+}
+
+
+void PrettyPrinter::VisitModuleLiteral(ModuleLiteral* node) {
+ VisitBlock(node->body());
+}
+
+
+void PrettyPrinter::VisitModuleVariable(ModuleVariable* node) {
+ PrintLiteral(node->var()->name(), false);
+}
+
+
+void PrettyPrinter::VisitModulePath(ModulePath* node) {
+ Visit(node->module());
+ Print(".");
+ PrintLiteral(node->name(), false);
+}
+
+
+void PrettyPrinter::VisitModuleUrl(ModuleUrl* node) {
+ Print("at ");
+ PrintLiteral(node->url(), true);
+}
+
+
void PrettyPrinter::VisitExpressionStatement(ExpressionStatement* node) {
Visit(node->expression());
Print(";");
@@ -728,6 +760,35 @@ void AstPrinter::VisitVariableDeclaration(VariableDeclaration* node) {
}
+void AstPrinter::VisitModuleDeclaration(ModuleDeclaration* node) {
+ IndentedScope indent(this, "MODULE");
+ PrintLiteralIndented("NAME", node->proxy()->name(), true);
+ Visit(node->module());
+}
+
+
+void AstPrinter::VisitModuleLiteral(ModuleLiteral* node) {
+ VisitBlock(node->body());
+}
+
+
+void AstPrinter::VisitModuleVariable(ModuleVariable* node) {
+ PrintLiteralIndented("VARIABLE", node->var()->name(), false);
+}
+
+
+void AstPrinter::VisitModulePath(ModulePath* node) {
+ IndentedScope indent(this, "PATH");
+ PrintIndentedVisit("MODULE", node->module());
+ PrintLiteralIndented("NAME", node->name(), false);
+}
+
+
+void AstPrinter::VisitModuleUrl(ModuleUrl* node) {
+ PrintLiteralIndented("URL", node->url(), true);
+}
+
+
void AstPrinter::VisitExpressionStatement(ExpressionStatement* node) {
Visit(node->expression());
}
« 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