Index: src/prettyprinter.cc |
diff --git a/src/prettyprinter.cc b/src/prettyprinter.cc |
index 0f5d225b650437e99d3e69ac120c8ce467a4ea86..1ff2edd2854adbdeab29b753bc3ba1c0119dba60 100644 |
--- a/src/prettyprinter.cc |
+++ b/src/prettyprinter.cc |
@@ -289,6 +289,21 @@ void PrettyPrinter::VisitFunctionLiteral(FunctionLiteral* node) { |
} |
+void PrettyPrinter::VisitClassLiteral(ClassLiteral* node) { |
+ Print("(class "); |
+ PrintLiteral(node->name(), false); |
+ if (node->extends()) { |
+ Print(" extends "); |
+ Visit(node->extends()); |
+ } |
+ Print(" { "); |
+ for (int i = 0; i < node->properties()->length(); i++) { |
+ PrintObjectLiteralProperty(node->properties()->at(i)); |
+ } |
+ Print(" })"); |
+} |
+ |
+ |
void PrettyPrinter::VisitNativeFunctionLiteral(NativeFunctionLiteral* node) { |
Print("("); |
PrintLiteral(node->name(), false); |
@@ -323,16 +338,22 @@ void PrettyPrinter::VisitObjectLiteral(ObjectLiteral* node) { |
Print("{ "); |
for (int i = 0; i < node->properties()->length(); i++) { |
if (i != 0) Print(","); |
- ObjectLiteral::Property* property = node->properties()->at(i); |
- Print(" "); |
- Visit(property->key()); |
- Print(": "); |
- Visit(property->value()); |
+ PrintObjectLiteralProperty(node->properties()->at(i)); |
} |
Print(" }"); |
} |
+void PrettyPrinter::PrintObjectLiteralProperty( |
+ ObjectLiteralProperty* property) { |
+ // TODO(arv): Better printing of methods etc. |
+ Print(" "); |
+ Visit(property->key()); |
+ Print(": "); |
+ Visit(property->value()); |
+} |
+ |
+ |
void PrettyPrinter::VisitArrayLiteral(ArrayLiteral* node) { |
Print("[ "); |
for (int i = 0; i < node->values()->length(); i++) { |
@@ -969,6 +990,12 @@ void AstPrinter::VisitFunctionLiteral(FunctionLiteral* node) { |
} |
+void AstPrinter::VisitClassLiteral(ClassLiteral* node) { |
+ IndentedScope indent(this, "CLASS LITERAL"); |
+ PrintLiteralIndented("NAME", node->name(), false); |
+} |
+ |
+ |
void AstPrinter::VisitNativeFunctionLiteral(NativeFunctionLiteral* node) { |
IndentedScope indent(this, "NATIVE FUNC LITERAL"); |
PrintLiteralIndented("NAME", node->name(), false); |