Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / v8 / src / prettyprinter.cc
index 19b0290..1ff2edd 100644 (file)
@@ -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++) {
@@ -447,6 +468,11 @@ void PrettyPrinter::VisitThisFunction(ThisFunction* node) {
 }
 
 
+void PrettyPrinter::VisitSuperReference(SuperReference* node) {
+  Print("<super-reference>");
+}
+
+
 const char* PrettyPrinter::Print(AstNode* node) {
   Init();
   Visit(node);
@@ -964,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);
@@ -1145,6 +1177,11 @@ void AstPrinter::VisitThisFunction(ThisFunction* node) {
   IndentedScope indent(this, "THIS-FUNCTION");
 }
 
+
+void AstPrinter::VisitSuperReference(SuperReference* node) {
+  IndentedScope indent(this, "SUPER-REFERENCE");
+}
+
 #endif  // DEBUG
 
 } }  // namespace v8::internal