OLD | NEW |
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 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 void PrettyPrinter::VisitConditional(Conditional* node) { | 308 void PrettyPrinter::VisitConditional(Conditional* node) { |
309 Visit(node->condition()); | 309 Visit(node->condition()); |
310 Print(" ? "); | 310 Print(" ? "); |
311 Visit(node->then_expression()); | 311 Visit(node->then_expression()); |
312 Print(" : "); | 312 Print(" : "); |
313 Visit(node->else_expression()); | 313 Visit(node->else_expression()); |
314 } | 314 } |
315 | 315 |
316 | 316 |
317 void PrettyPrinter::VisitLiteral(Literal* node) { | 317 void PrettyPrinter::VisitLiteral(Literal* node) { |
318 PrintLiteral(node->handle(), true); | 318 PrintLiteral(node->value(), true); |
319 } | 319 } |
320 | 320 |
321 | 321 |
322 void PrettyPrinter::VisitRegExpLiteral(RegExpLiteral* node) { | 322 void PrettyPrinter::VisitRegExpLiteral(RegExpLiteral* node) { |
323 Print(" RegExp("); | 323 Print(" RegExp("); |
324 PrintLiteral(node->pattern(), false); | 324 PrintLiteral(node->pattern(), false); |
325 Print(","); | 325 Print(","); |
326 PrintLiteral(node->flags(), false); | 326 PrintLiteral(node->flags(), false); |
327 Print(") "); | 327 Print(") "); |
328 } | 328 } |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 | 372 |
373 void PrettyPrinter::VisitThrow(Throw* node) { | 373 void PrettyPrinter::VisitThrow(Throw* node) { |
374 Print("throw "); | 374 Print("throw "); |
375 Visit(node->exception()); | 375 Visit(node->exception()); |
376 } | 376 } |
377 | 377 |
378 | 378 |
379 void PrettyPrinter::VisitProperty(Property* node) { | 379 void PrettyPrinter::VisitProperty(Property* node) { |
380 Expression* key = node->key(); | 380 Expression* key = node->key(); |
381 Literal* literal = key->AsLiteral(); | 381 Literal* literal = key->AsLiteral(); |
382 if (literal != NULL && literal->handle()->IsInternalizedString()) { | 382 if (literal != NULL && literal->value()->IsInternalizedString()) { |
383 Print("("); | 383 Print("("); |
384 Visit(node->obj()); | 384 Visit(node->obj()); |
385 Print(")."); | 385 Print(")."); |
386 PrintLiteral(literal->handle(), false); | 386 PrintLiteral(literal->value(), false); |
387 } else { | 387 } else { |
388 Visit(node->obj()); | 388 Visit(node->obj()); |
389 Print("["); | 389 Print("["); |
390 Visit(key); | 390 Visit(key); |
391 Print("]"); | 391 Print("]"); |
392 } | 392 } |
393 } | 393 } |
394 | 394 |
395 | 395 |
396 void PrettyPrinter::VisitCall(Call* node) { | 396 void PrettyPrinter::VisitCall(Call* node) { |
(...skipping 595 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
992 void AstPrinter::VisitConditional(Conditional* node) { | 992 void AstPrinter::VisitConditional(Conditional* node) { |
993 IndentedScope indent(this, "CONDITIONAL"); | 993 IndentedScope indent(this, "CONDITIONAL"); |
994 PrintIndentedVisit("CONDITION", node->condition()); | 994 PrintIndentedVisit("CONDITION", node->condition()); |
995 PrintIndentedVisit("THEN", node->then_expression()); | 995 PrintIndentedVisit("THEN", node->then_expression()); |
996 PrintIndentedVisit("ELSE", node->else_expression()); | 996 PrintIndentedVisit("ELSE", node->else_expression()); |
997 } | 997 } |
998 | 998 |
999 | 999 |
1000 // TODO(svenpanne) Start with IndentedScope. | 1000 // TODO(svenpanne) Start with IndentedScope. |
1001 void AstPrinter::VisitLiteral(Literal* node) { | 1001 void AstPrinter::VisitLiteral(Literal* node) { |
1002 PrintLiteralIndented("LITERAL", node->handle(), true); | 1002 PrintLiteralIndented("LITERAL", node->value(), true); |
1003 } | 1003 } |
1004 | 1004 |
1005 | 1005 |
1006 void AstPrinter::VisitRegExpLiteral(RegExpLiteral* node) { | 1006 void AstPrinter::VisitRegExpLiteral(RegExpLiteral* node) { |
1007 IndentedScope indent(this, "REGEXP LITERAL"); | 1007 IndentedScope indent(this, "REGEXP LITERAL"); |
1008 PrintLiteralIndented("PATTERN", node->pattern(), false); | 1008 PrintLiteralIndented("PATTERN", node->pattern(), false); |
1009 PrintLiteralIndented("FLAGS", node->flags(), false); | 1009 PrintLiteralIndented("FLAGS", node->flags(), false); |
1010 } | 1010 } |
1011 | 1011 |
1012 | 1012 |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1095 void AstPrinter::VisitThrow(Throw* node) { | 1095 void AstPrinter::VisitThrow(Throw* node) { |
1096 IndentedScope indent(this, "THROW"); | 1096 IndentedScope indent(this, "THROW"); |
1097 Visit(node->exception()); | 1097 Visit(node->exception()); |
1098 } | 1098 } |
1099 | 1099 |
1100 | 1100 |
1101 void AstPrinter::VisitProperty(Property* node) { | 1101 void AstPrinter::VisitProperty(Property* node) { |
1102 IndentedScope indent(this, "PROPERTY"); | 1102 IndentedScope indent(this, "PROPERTY"); |
1103 Visit(node->obj()); | 1103 Visit(node->obj()); |
1104 Literal* literal = node->key()->AsLiteral(); | 1104 Literal* literal = node->key()->AsLiteral(); |
1105 if (literal != NULL && literal->handle()->IsInternalizedString()) { | 1105 if (literal != NULL && literal->value()->IsInternalizedString()) { |
1106 PrintLiteralIndented("NAME", literal->handle(), false); | 1106 PrintLiteralIndented("NAME", literal->value(), false); |
1107 } else { | 1107 } else { |
1108 PrintIndentedVisit("KEY", node->key()); | 1108 PrintIndentedVisit("KEY", node->key()); |
1109 } | 1109 } |
1110 } | 1110 } |
1111 | 1111 |
1112 | 1112 |
1113 void AstPrinter::VisitCall(Call* node) { | 1113 void AstPrinter::VisitCall(Call* node) { |
1114 IndentedScope indent(this, "CALL"); | 1114 IndentedScope indent(this, "CALL"); |
1115 Visit(node->expression()); | 1115 Visit(node->expression()); |
1116 PrintArguments(node->arguments()); | 1116 PrintArguments(node->arguments()); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1160 } | 1160 } |
1161 | 1161 |
1162 | 1162 |
1163 void AstPrinter::VisitThisFunction(ThisFunction* node) { | 1163 void AstPrinter::VisitThisFunction(ThisFunction* node) { |
1164 IndentedScope indent(this, "THIS-FUNCTION"); | 1164 IndentedScope indent(this, "THIS-FUNCTION"); |
1165 } | 1165 } |
1166 | 1166 |
1167 #endif // DEBUG | 1167 #endif // DEBUG |
1168 | 1168 |
1169 } } // namespace v8::internal | 1169 } } // namespace v8::internal |
OLD | NEW |