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 610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
621 PrintStatements(clause->statements()); | 621 PrintStatements(clause->statements()); |
622 if (clause->statements()->length() > 0) | 622 if (clause->statements()->length() > 0) |
623 Print(" "); | 623 Print(" "); |
624 } | 624 } |
625 | 625 |
626 | 626 |
627 //----------------------------------------------------------------------------- | 627 //----------------------------------------------------------------------------- |
628 | 628 |
629 class IndentedScope BASE_EMBEDDED { | 629 class IndentedScope BASE_EMBEDDED { |
630 public: | 630 public: |
631 explicit IndentedScope(AstPrinter* printer) : ast_printer_(printer) { | |
632 ast_printer_->inc_indent(); | |
633 } | |
634 | |
635 IndentedScope(AstPrinter* printer, const char* txt) | 631 IndentedScope(AstPrinter* printer, const char* txt) |
636 : ast_printer_(printer) { | 632 : ast_printer_(printer) { |
637 ast_printer_->PrintIndented(txt); | 633 ast_printer_->PrintIndented(txt); |
638 ast_printer_->Print("\n"); | 634 ast_printer_->Print("\n"); |
639 ast_printer_->inc_indent(); | 635 ast_printer_->inc_indent(); |
640 } | 636 } |
641 | 637 |
642 virtual ~IndentedScope() { | 638 virtual ~IndentedScope() { |
643 ast_printer_->dec_indent(); | 639 ast_printer_->dec_indent(); |
644 } | 640 } |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
686 } else { | 682 } else { |
687 EmbeddedVector<char, 256> buf; | 683 EmbeddedVector<char, 256> buf; |
688 int pos = OS::SNPrintF(buf, "%s (mode = %s", info, | 684 int pos = OS::SNPrintF(buf, "%s (mode = %s", info, |
689 Variable::Mode2String(var->mode())); | 685 Variable::Mode2String(var->mode())); |
690 OS::SNPrintF(buf + pos, ")"); | 686 OS::SNPrintF(buf + pos, ")"); |
691 PrintLiteralIndented(buf.start(), value, true); | 687 PrintLiteralIndented(buf.start(), value, true); |
692 } | 688 } |
693 } | 689 } |
694 | 690 |
695 | 691 |
696 void AstPrinter::PrintLabelsIndented(const char* info, ZoneStringList* labels) { | 692 void AstPrinter::PrintLabelsIndented(ZoneStringList* labels) { |
697 if (labels != NULL && labels->length() > 0) { | 693 if (labels == NULL || labels->length() == 0) return; |
698 PrintIndented(info == NULL ? "LABELS" : info); | 694 PrintIndented("LABELS "); |
699 Print(" "); | 695 PrintLabels(labels); |
700 PrintLabels(labels); | 696 Print("\n"); |
701 Print("\n"); | |
702 } else if (info != NULL) { | |
703 PrintIndented(info); | |
704 Print("\n"); | |
705 } | |
706 } | 697 } |
707 | 698 |
708 | 699 |
709 void AstPrinter::PrintIndentedVisit(const char* s, AstNode* node) { | 700 void AstPrinter::PrintIndentedVisit(const char* s, AstNode* node) { |
710 IndentedScope indent(this, s); | 701 IndentedScope indent(this, s); |
711 Visit(node); | 702 Visit(node); |
712 } | 703 } |
713 | 704 |
714 | 705 |
715 const char* AstPrinter::PrintProgram(FunctionLiteral* program) { | 706 const char* AstPrinter::PrintProgram(FunctionLiteral* program) { |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
772 } | 763 } |
773 | 764 |
774 | 765 |
775 void AstPrinter::VisitBlock(Block* node) { | 766 void AstPrinter::VisitBlock(Block* node) { |
776 const char* block_txt = node->is_initializer_block() ? "BLOCK INIT" : "BLOCK"; | 767 const char* block_txt = node->is_initializer_block() ? "BLOCK INIT" : "BLOCK"; |
777 IndentedScope indent(this, block_txt); | 768 IndentedScope indent(this, block_txt); |
778 PrintStatements(node->statements()); | 769 PrintStatements(node->statements()); |
779 } | 770 } |
780 | 771 |
781 | 772 |
773 // TODO(svenpanne) Start with IndentedScope. | |
mvstanton
2013/05/08 13:11:03
Actually can you fold the fix in here instead of t
Sven Panne
2013/05/08 13:23:56
Actually no, or at least not easily: As usual, we
| |
782 void AstPrinter::VisitVariableDeclaration(VariableDeclaration* node) { | 774 void AstPrinter::VisitVariableDeclaration(VariableDeclaration* node) { |
783 PrintLiteralWithModeIndented(Variable::Mode2String(node->mode()), | 775 PrintLiteralWithModeIndented(Variable::Mode2String(node->mode()), |
784 node->proxy()->var(), | 776 node->proxy()->var(), |
785 node->proxy()->name()); | 777 node->proxy()->name()); |
786 } | 778 } |
787 | 779 |
788 | 780 |
781 // TODO(svenpanne) Start with IndentedScope. | |
mvstanton
2013/05/08 13:11:03
And here.
| |
789 void AstPrinter::VisitFunctionDeclaration(FunctionDeclaration* node) { | 782 void AstPrinter::VisitFunctionDeclaration(FunctionDeclaration* node) { |
790 PrintIndented("FUNCTION "); | 783 PrintIndented("FUNCTION "); |
791 PrintLiteral(node->proxy()->name(), true); | 784 PrintLiteral(node->proxy()->name(), true); |
792 Print(" = function "); | 785 Print(" = function "); |
793 PrintLiteral(node->fun()->name(), false); | 786 PrintLiteral(node->fun()->name(), false); |
794 Print("\n"); | 787 Print("\n"); |
795 } | 788 } |
796 | 789 |
797 | 790 |
798 void AstPrinter::VisitModuleDeclaration(ModuleDeclaration* node) { | 791 void AstPrinter::VisitModuleDeclaration(ModuleDeclaration* node) { |
(...skipping 10 matching lines...) Expand all Loading... | |
809 } | 802 } |
810 | 803 |
811 | 804 |
812 void AstPrinter::VisitExportDeclaration(ExportDeclaration* node) { | 805 void AstPrinter::VisitExportDeclaration(ExportDeclaration* node) { |
813 IndentedScope indent(this, "EXPORT "); | 806 IndentedScope indent(this, "EXPORT "); |
814 PrintLiteral(node->proxy()->name(), true); | 807 PrintLiteral(node->proxy()->name(), true); |
815 } | 808 } |
816 | 809 |
817 | 810 |
818 void AstPrinter::VisitModuleLiteral(ModuleLiteral* node) { | 811 void AstPrinter::VisitModuleLiteral(ModuleLiteral* node) { |
812 IndentedScope indent(this, "MODULE LITERAL"); | |
819 VisitBlock(node->body()); | 813 VisitBlock(node->body()); |
820 } | 814 } |
821 | 815 |
822 | 816 |
823 void AstPrinter::VisitModuleVariable(ModuleVariable* node) { | 817 void AstPrinter::VisitModuleVariable(ModuleVariable* node) { |
818 IndentedScope indent(this, "MODULE VARIABLE"); | |
824 Visit(node->proxy()); | 819 Visit(node->proxy()); |
825 } | 820 } |
826 | 821 |
827 | 822 |
828 void AstPrinter::VisitModulePath(ModulePath* node) { | 823 void AstPrinter::VisitModulePath(ModulePath* node) { |
829 IndentedScope indent(this, "PATH"); | 824 IndentedScope indent(this, "MODULE PATH"); |
830 PrintIndentedVisit("MODULE", node->module()); | 825 PrintIndentedVisit("MODULE PATH PARENT", node->module()); |
831 PrintLiteralIndented("NAME", node->name(), false); | 826 PrintLiteralIndented("NAME", node->name(), true); |
832 } | 827 } |
833 | 828 |
834 | 829 |
835 void AstPrinter::VisitModuleUrl(ModuleUrl* node) { | 830 void AstPrinter::VisitModuleUrl(ModuleUrl* node) { |
836 PrintLiteralIndented("URL", node->url(), true); | 831 PrintLiteralIndented("URL", node->url(), true); |
837 } | 832 } |
838 | 833 |
839 | 834 |
840 void AstPrinter::VisitModuleStatement(ModuleStatement* node) { | 835 void AstPrinter::VisitModuleStatement(ModuleStatement* node) { |
841 IndentedScope indent(this, "MODULE"); | 836 IndentedScope indent(this, "MODULE STATEMENT"); |
842 PrintLiteralIndented("NAME", node->proxy()->name(), true); | 837 PrintLiteralIndented("NAME", node->proxy()->name(), true); |
843 PrintStatements(node->body()->statements()); | 838 PrintStatements(node->body()->statements()); |
844 } | 839 } |
845 | 840 |
846 | 841 |
847 void AstPrinter::VisitExpressionStatement(ExpressionStatement* node) { | 842 void AstPrinter::VisitExpressionStatement(ExpressionStatement* node) { |
843 IndentedScope indent(this, "EXPRESSION STATEMENT"); | |
848 Visit(node->expression()); | 844 Visit(node->expression()); |
849 } | 845 } |
850 | 846 |
851 | 847 |
852 void AstPrinter::VisitEmptyStatement(EmptyStatement* node) { | 848 void AstPrinter::VisitEmptyStatement(EmptyStatement* node) { |
853 PrintIndented("EMPTY\n"); | 849 IndentedScope indent(this, "EMPTY"); |
854 } | 850 } |
855 | 851 |
856 | 852 |
857 void AstPrinter::VisitIfStatement(IfStatement* node) { | 853 void AstPrinter::VisitIfStatement(IfStatement* node) { |
858 PrintIndentedVisit("IF", node->condition()); | 854 IndentedScope indent(this, "IF"); |
855 PrintIndentedVisit("CONDITION", node->condition()); | |
859 PrintIndentedVisit("THEN", node->then_statement()); | 856 PrintIndentedVisit("THEN", node->then_statement()); |
860 if (node->HasElseStatement()) { | 857 if (node->HasElseStatement()) { |
861 PrintIndentedVisit("ELSE", node->else_statement()); | 858 PrintIndentedVisit("ELSE", node->else_statement()); |
862 } | 859 } |
863 } | 860 } |
864 | 861 |
865 | 862 |
866 void AstPrinter::VisitContinueStatement(ContinueStatement* node) { | 863 void AstPrinter::VisitContinueStatement(ContinueStatement* node) { |
867 PrintLabelsIndented("CONTINUE", node->target()->labels()); | 864 IndentedScope indent(this, "CONTINUE"); |
865 PrintLabelsIndented(node->target()->labels()); | |
868 } | 866 } |
869 | 867 |
870 | 868 |
871 void AstPrinter::VisitBreakStatement(BreakStatement* node) { | 869 void AstPrinter::VisitBreakStatement(BreakStatement* node) { |
872 PrintLabelsIndented("BREAK", node->target()->labels()); | 870 IndentedScope indent(this, "BREAK"); |
871 PrintLabelsIndented(node->target()->labels()); | |
873 } | 872 } |
874 | 873 |
875 | 874 |
876 void AstPrinter::VisitReturnStatement(ReturnStatement* node) { | 875 void AstPrinter::VisitReturnStatement(ReturnStatement* node) { |
877 PrintIndentedVisit("RETURN", node->expression()); | 876 IndentedScope indent(this, "RETURN"); |
877 Visit(node->expression()); | |
878 } | 878 } |
879 | 879 |
880 | 880 |
881 void AstPrinter::VisitWithStatement(WithStatement* node) { | 881 void AstPrinter::VisitWithStatement(WithStatement* node) { |
882 IndentedScope indent(this, "WITH"); | 882 IndentedScope indent(this, "WITH"); |
883 PrintIndentedVisit("OBJECT", node->expression()); | 883 PrintIndentedVisit("OBJECT", node->expression()); |
884 PrintIndentedVisit("BODY", node->statement()); | 884 PrintIndentedVisit("BODY", node->statement()); |
885 } | 885 } |
886 | 886 |
887 | 887 |
888 void AstPrinter::VisitSwitchStatement(SwitchStatement* node) { | 888 void AstPrinter::VisitSwitchStatement(SwitchStatement* node) { |
889 IndentedScope indent(this, "SWITCH"); | 889 IndentedScope indent(this, "SWITCH"); |
890 PrintLabelsIndented(NULL, node->labels()); | 890 PrintLabelsIndented(node->labels()); |
891 PrintIndentedVisit("TAG", node->tag()); | 891 PrintIndentedVisit("TAG", node->tag()); |
892 for (int i = 0; i < node->cases()->length(); i++) { | 892 for (int i = 0; i < node->cases()->length(); i++) { |
893 PrintCaseClause(node->cases()->at(i)); | 893 PrintCaseClause(node->cases()->at(i)); |
894 } | 894 } |
895 } | 895 } |
896 | 896 |
897 | 897 |
898 void AstPrinter::VisitDoWhileStatement(DoWhileStatement* node) { | 898 void AstPrinter::VisitDoWhileStatement(DoWhileStatement* node) { |
899 IndentedScope indent(this, "DO"); | 899 IndentedScope indent(this, "DO"); |
900 PrintLabelsIndented(NULL, node->labels()); | 900 PrintLabelsIndented(node->labels()); |
901 PrintIndentedVisit("BODY", node->body()); | 901 PrintIndentedVisit("BODY", node->body()); |
902 PrintIndentedVisit("COND", node->cond()); | 902 PrintIndentedVisit("COND", node->cond()); |
903 } | 903 } |
904 | 904 |
905 | 905 |
906 void AstPrinter::VisitWhileStatement(WhileStatement* node) { | 906 void AstPrinter::VisitWhileStatement(WhileStatement* node) { |
907 IndentedScope indent(this, "WHILE"); | 907 IndentedScope indent(this, "WHILE"); |
908 PrintLabelsIndented(NULL, node->labels()); | 908 PrintLabelsIndented(node->labels()); |
909 PrintIndentedVisit("COND", node->cond()); | 909 PrintIndentedVisit("COND", node->cond()); |
910 PrintIndentedVisit("BODY", node->body()); | 910 PrintIndentedVisit("BODY", node->body()); |
911 } | 911 } |
912 | 912 |
913 | 913 |
914 void AstPrinter::VisitForStatement(ForStatement* node) { | 914 void AstPrinter::VisitForStatement(ForStatement* node) { |
915 IndentedScope indent(this, "FOR"); | 915 IndentedScope indent(this, "FOR"); |
916 PrintLabelsIndented(NULL, node->labels()); | 916 PrintLabelsIndented(node->labels()); |
917 if (node->init()) PrintIndentedVisit("INIT", node->init()); | 917 if (node->init()) PrintIndentedVisit("INIT", node->init()); |
918 if (node->cond()) PrintIndentedVisit("COND", node->cond()); | 918 if (node->cond()) PrintIndentedVisit("COND", node->cond()); |
919 PrintIndentedVisit("BODY", node->body()); | 919 PrintIndentedVisit("BODY", node->body()); |
920 if (node->next()) PrintIndentedVisit("NEXT", node->next()); | 920 if (node->next()) PrintIndentedVisit("NEXT", node->next()); |
921 } | 921 } |
922 | 922 |
923 | 923 |
924 void AstPrinter::VisitForInStatement(ForInStatement* node) { | 924 void AstPrinter::VisitForInStatement(ForInStatement* node) { |
925 IndentedScope indent(this, "FOR IN"); | 925 IndentedScope indent(this, "FOR IN"); |
926 PrintIndentedVisit("FOR", node->each()); | 926 PrintIndentedVisit("FOR", node->each()); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
965 | 965 |
966 void AstPrinter::VisitSharedFunctionInfoLiteral( | 966 void AstPrinter::VisitSharedFunctionInfoLiteral( |
967 SharedFunctionInfoLiteral* node) { | 967 SharedFunctionInfoLiteral* node) { |
968 IndentedScope indent(this, "FUNC LITERAL"); | 968 IndentedScope indent(this, "FUNC LITERAL"); |
969 PrintLiteralIndented("SHARED INFO", node->shared_function_info(), true); | 969 PrintLiteralIndented("SHARED INFO", node->shared_function_info(), true); |
970 } | 970 } |
971 | 971 |
972 | 972 |
973 void AstPrinter::VisitConditional(Conditional* node) { | 973 void AstPrinter::VisitConditional(Conditional* node) { |
974 IndentedScope indent(this, "CONDITIONAL"); | 974 IndentedScope indent(this, "CONDITIONAL"); |
975 PrintIndentedVisit("?", node->condition()); | 975 PrintIndentedVisit("CONDITION", node->condition()); |
976 PrintIndentedVisit("THEN", node->then_expression()); | 976 PrintIndentedVisit("THEN", node->then_expression()); |
977 PrintIndentedVisit("ELSE", node->else_expression()); | 977 PrintIndentedVisit("ELSE", node->else_expression()); |
978 } | 978 } |
979 | 979 |
980 | 980 |
981 // TODO(svenpanne) Start with IndentedScope. | |
981 void AstPrinter::VisitLiteral(Literal* node) { | 982 void AstPrinter::VisitLiteral(Literal* node) { |
982 PrintLiteralIndented("LITERAL", node->handle(), true); | 983 PrintLiteralIndented("LITERAL", node->handle(), true); |
983 } | 984 } |
984 | 985 |
985 | 986 |
986 void AstPrinter::VisitRegExpLiteral(RegExpLiteral* node) { | 987 void AstPrinter::VisitRegExpLiteral(RegExpLiteral* node) { |
987 IndentedScope indent(this, "REGEXP LITERAL"); | 988 IndentedScope indent(this, "REGEXP LITERAL"); |
988 PrintLiteralIndented("PATTERN", node->pattern(), false); | 989 PrintLiteralIndented("PATTERN", node->pattern(), false); |
989 PrintLiteralIndented("FLAGS", node->flags(), false); | 990 PrintLiteralIndented("FLAGS", node->flags(), false); |
990 } | 991 } |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1027 IndentedScope indent(this, "ARRAY LITERAL"); | 1028 IndentedScope indent(this, "ARRAY LITERAL"); |
1028 if (node->values()->length() > 0) { | 1029 if (node->values()->length() > 0) { |
1029 IndentedScope indent(this, "VALUES"); | 1030 IndentedScope indent(this, "VALUES"); |
1030 for (int i = 0; i < node->values()->length(); i++) { | 1031 for (int i = 0; i < node->values()->length(); i++) { |
1031 Visit(node->values()->at(i)); | 1032 Visit(node->values()->at(i)); |
1032 } | 1033 } |
1033 } | 1034 } |
1034 } | 1035 } |
1035 | 1036 |
1036 | 1037 |
1038 // TODO(svenpanne) Start with IndentedScope. | |
1037 void AstPrinter::VisitVariableProxy(VariableProxy* node) { | 1039 void AstPrinter::VisitVariableProxy(VariableProxy* node) { |
1038 Variable* var = node->var(); | 1040 Variable* var = node->var(); |
1039 EmbeddedVector<char, 128> buf; | 1041 EmbeddedVector<char, 128> buf; |
1040 int pos = OS::SNPrintF(buf, "VAR PROXY"); | 1042 int pos = OS::SNPrintF(buf, "VAR PROXY"); |
1041 switch (var->location()) { | 1043 switch (var->location()) { |
1042 case Variable::UNALLOCATED: | 1044 case Variable::UNALLOCATED: |
1043 break; | 1045 break; |
1044 case Variable::PARAMETER: | 1046 case Variable::PARAMETER: |
1045 OS::SNPrintF(buf + pos, " parameter[%d]", var->index()); | 1047 OS::SNPrintF(buf + pos, " parameter[%d]", var->index()); |
1046 break; | 1048 break; |
(...skipping 12 matching lines...) Expand all Loading... | |
1059 | 1061 |
1060 | 1062 |
1061 void AstPrinter::VisitAssignment(Assignment* node) { | 1063 void AstPrinter::VisitAssignment(Assignment* node) { |
1062 IndentedScope indent(this, Token::Name(node->op())); | 1064 IndentedScope indent(this, Token::Name(node->op())); |
1063 Visit(node->target()); | 1065 Visit(node->target()); |
1064 Visit(node->value()); | 1066 Visit(node->value()); |
1065 } | 1067 } |
1066 | 1068 |
1067 | 1069 |
1068 void AstPrinter::VisitYield(Yield* node) { | 1070 void AstPrinter::VisitYield(Yield* node) { |
1069 PrintIndentedVisit("YIELD", node->expression()); | 1071 IndentedScope indent(this, "YIELD"); |
1072 Visit(node->expression()); | |
1070 } | 1073 } |
1071 | 1074 |
1072 | 1075 |
1073 void AstPrinter::VisitThrow(Throw* node) { | 1076 void AstPrinter::VisitThrow(Throw* node) { |
1074 PrintIndentedVisit("THROW", node->exception()); | 1077 IndentedScope indent(this, "THROW"); |
1078 Visit(node->exception()); | |
1075 } | 1079 } |
1076 | 1080 |
1077 | 1081 |
1078 void AstPrinter::VisitProperty(Property* node) { | 1082 void AstPrinter::VisitProperty(Property* node) { |
1079 IndentedScope indent(this, "PROPERTY"); | 1083 IndentedScope indent(this, "PROPERTY"); |
1080 Visit(node->obj()); | 1084 Visit(node->obj()); |
1081 Literal* literal = node->key()->AsLiteral(); | 1085 Literal* literal = node->key()->AsLiteral(); |
1082 if (literal != NULL && literal->handle()->IsInternalizedString()) { | 1086 if (literal != NULL && literal->handle()->IsInternalizedString()) { |
1083 PrintLiteralIndented("NAME", literal->handle(), false); | 1087 PrintLiteralIndented("NAME", literal->handle(), false); |
1084 } else { | 1088 } else { |
(...skipping 10 matching lines...) Expand all Loading... | |
1095 | 1099 |
1096 | 1100 |
1097 void AstPrinter::VisitCallNew(CallNew* node) { | 1101 void AstPrinter::VisitCallNew(CallNew* node) { |
1098 IndentedScope indent(this, "CALL NEW"); | 1102 IndentedScope indent(this, "CALL NEW"); |
1099 Visit(node->expression()); | 1103 Visit(node->expression()); |
1100 PrintArguments(node->arguments()); | 1104 PrintArguments(node->arguments()); |
1101 } | 1105 } |
1102 | 1106 |
1103 | 1107 |
1104 void AstPrinter::VisitCallRuntime(CallRuntime* node) { | 1108 void AstPrinter::VisitCallRuntime(CallRuntime* node) { |
1105 PrintLiteralIndented("CALL RUNTIME ", node->name(), false); | 1109 IndentedScope indent(this, "CALL RUNTIME"); |
1106 IndentedScope indent(this); | 1110 PrintLiteralIndented("NAME", node->name(), false); |
1107 PrintArguments(node->arguments()); | 1111 PrintArguments(node->arguments()); |
1108 } | 1112 } |
1109 | 1113 |
1110 | 1114 |
1111 void AstPrinter::VisitUnaryOperation(UnaryOperation* node) { | 1115 void AstPrinter::VisitUnaryOperation(UnaryOperation* node) { |
1112 PrintIndentedVisit(Token::Name(node->op()), node->expression()); | 1116 IndentedScope indent(this, Token::Name(node->op())); |
1117 Visit(node->expression()); | |
1113 } | 1118 } |
1114 | 1119 |
1115 | 1120 |
1116 void AstPrinter::VisitCountOperation(CountOperation* node) { | 1121 void AstPrinter::VisitCountOperation(CountOperation* node) { |
1117 EmbeddedVector<char, 128> buf; | 1122 EmbeddedVector<char, 128> buf; |
1118 OS::SNPrintF(buf, "%s %s", (node->is_prefix() ? "PRE" : "POST"), | 1123 OS::SNPrintF(buf, "%s %s", (node->is_prefix() ? "PRE" : "POST"), |
1119 Token::Name(node->op())); | 1124 Token::Name(node->op())); |
1120 PrintIndentedVisit(buf.start(), node->expression()); | 1125 IndentedScope indent(this, buf.start()); |
1126 Visit(node->expression()); | |
1121 } | 1127 } |
1122 | 1128 |
1123 | 1129 |
1124 void AstPrinter::VisitBinaryOperation(BinaryOperation* node) { | 1130 void AstPrinter::VisitBinaryOperation(BinaryOperation* node) { |
1125 IndentedScope indent(this, Token::Name(node->op())); | 1131 IndentedScope indent(this, Token::Name(node->op())); |
1126 Visit(node->left()); | 1132 Visit(node->left()); |
1127 Visit(node->right()); | 1133 Visit(node->right()); |
1128 } | 1134 } |
1129 | 1135 |
1130 | 1136 |
1131 void AstPrinter::VisitCompareOperation(CompareOperation* node) { | 1137 void AstPrinter::VisitCompareOperation(CompareOperation* node) { |
1132 IndentedScope indent(this, Token::Name(node->op())); | 1138 IndentedScope indent(this, Token::Name(node->op())); |
1133 Visit(node->left()); | 1139 Visit(node->left()); |
1134 Visit(node->right()); | 1140 Visit(node->right()); |
1135 } | 1141 } |
1136 | 1142 |
1137 | 1143 |
1138 void AstPrinter::VisitThisFunction(ThisFunction* node) { | 1144 void AstPrinter::VisitThisFunction(ThisFunction* node) { |
1139 IndentedScope indent(this, "THIS-FUNCTION"); | 1145 IndentedScope indent(this, "THIS-FUNCTION"); |
1140 } | 1146 } |
1141 | 1147 |
1142 #endif // DEBUG | 1148 #endif // DEBUG |
1143 | 1149 |
1144 } } // namespace v8::internal | 1150 } } // namespace v8::internal |
OLD | NEW |