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

Side by Side Diff: src/prettyprinter.cc

Issue 9496003: AST extensions and parsing for import & export declarations. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 9 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
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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 76
77 void PrettyPrinter::VisitModuleDeclaration(ModuleDeclaration* node) { 77 void PrettyPrinter::VisitModuleDeclaration(ModuleDeclaration* node) {
78 Print("module "); 78 Print("module ");
79 PrintLiteral(node->proxy()->name(), false); 79 PrintLiteral(node->proxy()->name(), false);
80 Print(" = "); 80 Print(" = ");
81 Visit(node->module()); 81 Visit(node->module());
82 Print(";"); 82 Print(";");
83 } 83 }
84 84
85 85
86 void PrettyPrinter::VisitImportDeclaration(ImportDeclaration* node) {
87 Print("import ");
88 PrintLiteral(node->proxy()->name(), false);
89 Print(" from ");
90 Visit(node->module());
91 Print(";");
92 }
93
94
95 void PrettyPrinter::VisitExportDeclaration(ExportDeclaration* node) {
96 Print("export ");
97 PrintLiteral(node->proxy()->name(), false);
98 Print(";");
99 }
100
101
86 void PrettyPrinter::VisitModuleLiteral(ModuleLiteral* node) { 102 void PrettyPrinter::VisitModuleLiteral(ModuleLiteral* node) {
87 VisitBlock(node->body()); 103 VisitBlock(node->body());
88 } 104 }
89 105
90 106
91 void PrettyPrinter::VisitModuleVariable(ModuleVariable* node) { 107 void PrettyPrinter::VisitModuleVariable(ModuleVariable* node) {
92 Visit(node->proxy()); 108 Visit(node->proxy());
93 } 109 }
94 110
95 111
(...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after
764 } 780 }
765 781
766 782
767 void AstPrinter::VisitModuleDeclaration(ModuleDeclaration* node) { 783 void AstPrinter::VisitModuleDeclaration(ModuleDeclaration* node) {
768 IndentedScope indent(this, "MODULE"); 784 IndentedScope indent(this, "MODULE");
769 PrintLiteralIndented("NAME", node->proxy()->name(), true); 785 PrintLiteralIndented("NAME", node->proxy()->name(), true);
770 Visit(node->module()); 786 Visit(node->module());
771 } 787 }
772 788
773 789
790 void AstPrinter::VisitImportDeclaration(ImportDeclaration* node) {
791 IndentedScope indent(this, "IMPORT");
792 PrintLiteralIndented("NAME", node->proxy()->name(), true);
793 Visit(node->module());
794 }
795
796
797 void AstPrinter::VisitExportDeclaration(ExportDeclaration* node) {
798 IndentedScope indent(this, "EXPORT ");
799 PrintLiteral(node->proxy()->name(), true);
800 }
801
802
774 void AstPrinter::VisitModuleLiteral(ModuleLiteral* node) { 803 void AstPrinter::VisitModuleLiteral(ModuleLiteral* node) {
775 VisitBlock(node->body()); 804 VisitBlock(node->body());
776 } 805 }
777 806
778 807
779 void AstPrinter::VisitModuleVariable(ModuleVariable* node) { 808 void AstPrinter::VisitModuleVariable(ModuleVariable* node) {
780 Visit(node->proxy()); 809 Visit(node->proxy());
781 } 810 }
782 811
783 812
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
1079 } 1108 }
1080 1109
1081 1110
1082 void AstPrinter::VisitThisFunction(ThisFunction* node) { 1111 void AstPrinter::VisitThisFunction(ThisFunction* node) {
1083 IndentedScope indent(this, "THIS-FUNCTION"); 1112 IndentedScope indent(this, "THIS-FUNCTION");
1084 } 1113 }
1085 1114
1086 #endif // DEBUG 1115 #endif // DEBUG
1087 1116
1088 } } // namespace v8::internal 1117 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/parser.cc ('k') | src/rewriter.cc » ('j') | test/mjsunit/harmony/module-parsing.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698