| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 365 | 365 |
| 366 void PrettyPrinter::VisitCompareOperation(CompareOperation* node) { | 366 void PrettyPrinter::VisitCompareOperation(CompareOperation* node) { |
| 367 Print("("); | 367 Print("("); |
| 368 Visit(node->left()); | 368 Visit(node->left()); |
| 369 Print(" %s ", Token::String(node->op())); | 369 Print(" %s ", Token::String(node->op())); |
| 370 Visit(node->right()); | 370 Visit(node->right()); |
| 371 Print(")"); | 371 Print(")"); |
| 372 } | 372 } |
| 373 | 373 |
| 374 | 374 |
| 375 void PrettyPrinter::VisitCompareToNull(CompareToNull* node) { | |
| 376 Print("("); | |
| 377 Visit(node->expression()); | |
| 378 Print("%s null)", Token::String(node->op())); | |
| 379 } | |
| 380 | |
| 381 | |
| 382 void PrettyPrinter::VisitThisFunction(ThisFunction* node) { | 375 void PrettyPrinter::VisitThisFunction(ThisFunction* node) { |
| 383 Print("<this-function>"); | 376 Print("<this-function>"); |
| 384 } | 377 } |
| 385 | 378 |
| 386 | 379 |
| 387 const char* PrettyPrinter::Print(AstNode* node) { | 380 const char* PrettyPrinter::Print(AstNode* node) { |
| 388 Init(); | 381 Init(); |
| 389 Visit(node); | 382 Visit(node); |
| 390 return output_; | 383 return output_; |
| 391 } | 384 } |
| (...skipping 621 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1013 } | 1006 } |
| 1014 | 1007 |
| 1015 | 1008 |
| 1016 void AstPrinter::VisitCompareOperation(CompareOperation* node) { | 1009 void AstPrinter::VisitCompareOperation(CompareOperation* node) { |
| 1017 IndentedScope indent(this, Token::Name(node->op()), node); | 1010 IndentedScope indent(this, Token::Name(node->op()), node); |
| 1018 Visit(node->left()); | 1011 Visit(node->left()); |
| 1019 Visit(node->right()); | 1012 Visit(node->right()); |
| 1020 } | 1013 } |
| 1021 | 1014 |
| 1022 | 1015 |
| 1023 void AstPrinter::VisitCompareToNull(CompareToNull* node) { | |
| 1024 const char* name = node->is_strict() | |
| 1025 ? "COMPARE-TO-NULL-STRICT" | |
| 1026 : "COMPARE-TO-NULL"; | |
| 1027 IndentedScope indent(this, name, node); | |
| 1028 Visit(node->expression()); | |
| 1029 } | |
| 1030 | |
| 1031 | |
| 1032 void AstPrinter::VisitThisFunction(ThisFunction* node) { | 1016 void AstPrinter::VisitThisFunction(ThisFunction* node) { |
| 1033 IndentedScope indent(this, "THIS-FUNCTION"); | 1017 IndentedScope indent(this, "THIS-FUNCTION"); |
| 1034 } | 1018 } |
| 1035 | 1019 |
| 1036 | 1020 |
| 1037 TagScope::TagScope(JsonAstBuilder* builder, const char* name) | 1021 TagScope::TagScope(JsonAstBuilder* builder, const char* name) |
| 1038 : builder_(builder), next_(builder->tag()), has_body_(false) { | 1022 : builder_(builder), next_(builder->tag()), has_body_(false) { |
| 1039 if (next_ != NULL) { | 1023 if (next_ != NULL) { |
| 1040 next_->use(); | 1024 next_->use(); |
| 1041 builder->Print(",\n"); | 1025 builder->Print(",\n"); |
| (...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1397 TagScope tag(this, "CompareOperation"); | 1381 TagScope tag(this, "CompareOperation"); |
| 1398 { | 1382 { |
| 1399 AttributesScope attributes(this); | 1383 AttributesScope attributes(this); |
| 1400 AddAttribute("op", Token::Name(expr->op())); | 1384 AddAttribute("op", Token::Name(expr->op())); |
| 1401 } | 1385 } |
| 1402 Visit(expr->left()); | 1386 Visit(expr->left()); |
| 1403 Visit(expr->right()); | 1387 Visit(expr->right()); |
| 1404 } | 1388 } |
| 1405 | 1389 |
| 1406 | 1390 |
| 1407 void JsonAstBuilder::VisitCompareToNull(CompareToNull* expr) { | |
| 1408 TagScope tag(this, "CompareToNull"); | |
| 1409 { | |
| 1410 AttributesScope attributes(this); | |
| 1411 AddAttribute("is_strict", expr->is_strict()); | |
| 1412 } | |
| 1413 Visit(expr->expression()); | |
| 1414 } | |
| 1415 | |
| 1416 | |
| 1417 void JsonAstBuilder::VisitThisFunction(ThisFunction* expr) { | 1391 void JsonAstBuilder::VisitThisFunction(ThisFunction* expr) { |
| 1418 TagScope tag(this, "ThisFunction"); | 1392 TagScope tag(this, "ThisFunction"); |
| 1419 } | 1393 } |
| 1420 | 1394 |
| 1421 | 1395 |
| 1422 void JsonAstBuilder::VisitDeclaration(Declaration* decl) { | 1396 void JsonAstBuilder::VisitDeclaration(Declaration* decl) { |
| 1423 TagScope tag(this, "Declaration"); | 1397 TagScope tag(this, "Declaration"); |
| 1424 { | 1398 { |
| 1425 AttributesScope attributes(this); | 1399 AttributesScope attributes(this); |
| 1426 AddAttribute("mode", Variable::Mode2String(decl->mode())); | 1400 AddAttribute("mode", Variable::Mode2String(decl->mode())); |
| 1427 } | 1401 } |
| 1428 Visit(decl->proxy()); | 1402 Visit(decl->proxy()); |
| 1429 if (decl->fun() != NULL) Visit(decl->fun()); | 1403 if (decl->fun() != NULL) Visit(decl->fun()); |
| 1430 } | 1404 } |
| 1431 | 1405 |
| 1432 | 1406 |
| 1433 #endif // DEBUG | 1407 #endif // DEBUG |
| 1434 | 1408 |
| 1435 } } // namespace v8::internal | 1409 } } // namespace v8::internal |
| OLD | NEW |