Home | History | Annotate | Download | only in ast

Lines Matching refs:node

37 void CallPrinter::Find(AstNode* node, bool print) {
42 Visit(node);
47 Visit(node);
63 void CallPrinter::VisitBlock(Block* node) {
64 FindStatements(node->statements());
68 void CallPrinter::VisitVariableDeclaration(VariableDeclaration* node) {}
71 void CallPrinter::VisitFunctionDeclaration(FunctionDeclaration* node) {}
74 void CallPrinter::VisitExpressionStatement(ExpressionStatement* node) {
75 Find(node->expression());
79 void CallPrinter::VisitEmptyStatement(EmptyStatement* node) {}
83 SloppyBlockFunctionStatement* node) {
84 Find(node->statement());
88 void CallPrinter::VisitIfStatement(IfStatement* node) {
89 Find(node->condition());
90 Find(node->then_statement());
91 if (node->HasElseStatement()) {
92 Find(node->else_statement());
97 void CallPrinter::VisitContinueStatement(ContinueStatement* node) {}
100 void CallPrinter::VisitBreakStatement(BreakStatement* node) {}
103 void CallPrinter::VisitReturnStatement(ReturnStatement* node) {
104 Find(node->expression());
108 void CallPrinter::VisitWithStatement(WithStatement* node) {
109 Find(node->expression());
110 Find(node->statement());
114 void CallPrinter::VisitSwitchStatement(SwitchStatement* node) {
115 Find(node->tag());
116 ZoneList<CaseClause*>* cases = node->cases();
129 void CallPrinter::VisitDoWhileStatement(DoWhileStatement* node) {
130 Find(node->body());
131 Find(node->cond());
135 void CallPrinter::VisitWhileStatement(WhileStatement* node) {
136 Find(node->cond());
137 Find(node->body());
141 void CallPrinter::VisitForStatement(ForStatement* node) {
142 if (node->init() != NULL) {
143 Find(node->init());
145 if (node->cond() != NULL) Find(node->cond());
146 if (node->next() != NULL) Find(node->next());
147 Find(node->body());
151 void CallPrinter::VisitForInStatement(ForInStatement* node) {
152 Find(node->each());
153 Find(node->enumerable());
154 Find(node->body());
158 void CallPrinter::VisitForOfStatement(ForOfStatement* node) {
159 Find(node->assign_iterator());
160 Find(node->next_result());
161 Find(node->result_done());
162 Find(node->assign_each());
163 Find(node->body());
167 void CallPrinter::VisitTryCatchStatement(TryCatchStatement* node) {
168 Find(node->try_block());
169 Find(node->catch_block());
173 void CallPrinter::VisitTryFinallyStatement(TryFinallyStatement* node) {
174 Find(node->try_block());
175 Find(node->finally_block());
179 void CallPrinter::VisitDebuggerStatement(DebuggerStatement* node) {}
182 void CallPrinter::VisitFunctionLiteral(FunctionLiteral* node) {
183 FindStatements(node->body());
187 void CallPrinter::VisitClassLiteral(ClassLiteral* node) {
188 if (node->extends()) Find(node->extends());
189 for (int i = 0; i < node->properties()->length(); i++) {
190 Find(node->properties()->at(i)->value());
195 void CallPrinter::VisitNativeFunctionLiteral(NativeFunctionLiteral* node) {}
198 void CallPrinter::VisitDoExpression(DoExpression* node) { Find(node->block()); }
201 void CallPrinter::VisitConditional(Conditional* node) {
202 Find(node->condition());
203 Find(node->then_expression());
204 Find(node->else_expression());
208 void CallPrinter::VisitLiteral(Literal* node) {
209 PrintLiteral(node->value(), true);
213 void CallPrinter::VisitRegExpLiteral(RegExpLiteral* node) {
215 PrintLiteral(node->pattern(), false);
217 if (node->flags() & RegExp::kGlobal) Print("g");
218 if (node->flags() & RegExp::kIgnoreCase) Print("i");
219 if (node->flags() & RegExp::kMultiline) Print("m");
220 if (node->flags() & RegExp::kUnicode) Print("u");
221 if (node->flags() & RegExp::kSticky) Print("y");
225 void CallPrinter::VisitObjectLiteral(ObjectLiteral* node) {
226 for (int i = 0; i < node->properties()->length(); i++) {
227 Find(node->properties()->at(i)->value());
232 void CallPrinter::VisitArrayLiteral(ArrayLiteral* node) {
234 for (int i = 0; i < node->values()->length(); i++) {
236 Find(node->values()->at(i), true);
242 void CallPrinter::VisitVariableProxy(VariableProxy* node) {
244 PrintLiteral(node->name(), false);
252 void CallPrinter::VisitAssignment(Assignment* node) {
253 Find(node->target());
254 Find(node->value());
258 void CallPrinter::VisitYield(Yield* node) { Find(node->expression()); }
261 void CallPrinter::VisitThrow(Throw* node) { Find(node->exception()); }
264 void CallPrinter::VisitProperty(Property* node) {
265 Expression* key = node->key();
268 Find(node->obj(), true);
272 Find(node->obj(), true);
280 void CallPrinter::VisitCall(Call* node) {
281 bool was_found = !found_ && node->position() == position_;
285 if (!is_user_js_ && node->expression()->IsVariableProxy()) {
291 Find(node->expression(), true);
293 FindArguments(node->arguments());
298 void CallPrinter::VisitCallNew(CallNew* node) {
299 bool was_found = !found_ && node->position() == position_;
303 if (!is_user_js_ && node->expression()->IsVariableProxy()) {
309 Find(node->expression(), was_found);
310 FindArguments(node->arguments());
315 void CallPrinter::VisitCallRuntime(CallRuntime* node) {
316 FindArguments(node->arguments());
320 void CallPrinter::VisitUnaryOperation(UnaryOperation* node) {
321 Token::Value op = node->op();
327 Find(node->expression(), true);
332 void CallPrinter::VisitCountOperation(CountOperation* node) {
334 if (node->is_prefix()) Print(Token::String(node->op()));
335 Find(node->expression(), true);
336 if (node->is_postfix()) Print(Token::String(node->op()));
341 void CallPrinter::VisitBinaryOperation(BinaryOperation* node) {
343 Find(node->left(), true);
345 Print(Token::String(node->op()));
347 Find(node->right(), true);
352 void CallPrinter::VisitCompareOperation(CompareOperation* node) {
354 Find(node->left(), true);
356 Print(Token::String(node->op()));
358 Find(node->right(), true);
363 void CallPrinter::VisitSpread(Spread* node) {
365 Find(node->expression(), true);
370 void CallPrinter::VisitEmptyParentheses(EmptyParentheses* node) {
374 void CallPrinter::VisitGetIterator(GetIterator* node) {
376 Find(node->iterable(), true);
380 void CallPrinter::VisitThisFunction(ThisFunction* node) {}
383 void CallPrinter::VisitSuperPropertyReference(SuperPropertyReference* node) {}
386 void CallPrinter::VisitSuperCallReference(SuperCallReference* node) {
391 void CallPrinter::VisitRewritableExpression(RewritableExpression* node) {
392 Find(node->expression());
444 static int FormatSlotNode(Vector<char>* buf, Expression* node,
453 const char* AstPrinter::Print(AstNode* node) {
455 Visit(node);
641 void AstPrinter::PrintIndentedVisit(const char* s, AstNode* node) {
642 IndentedScope indent(this, s, node->position());
643 Visit(node);
664 void AstPrinter::PrintOut(Isolate* isolate, AstNode* node) {
667 printer.Visit(node);
703 void AstPrinter::VisitBlock(Block* node) {
705 node->ignore_completion_value() ? "BLOCK NOCOMPLETIONS" : "BLOCK";
706 IndentedScope indent(this, block_txt, node->position());
707 PrintStatements(node->statements());
712 void AstPrinter::VisitVariableDeclaration(VariableDeclaration* node) {
713 PrintLiteralWithModeIndented("VARIABLE", node->proxy()->var(),
714 node->proxy()->name());
719 void AstPrinter::VisitFunctionDeclaration(FunctionDeclaration* node) {
721 PrintLiteral(node->proxy()->name(), true);
723 PrintLiteral(node->fun()->name(), false);
728 void AstPrinter::VisitExpressionStatement(ExpressionStatement* node) {
729 IndentedScope indent(this, "EXPRESSION STATEMENT", node->position());
730 Visit(node->expression());
734 void AstPrinter::VisitEmptyStatement(EmptyStatement* node) {
735 IndentedScope indent(this, "EMPTY", node->position());
740 SloppyBlockFunctionStatement* node) {
741 Visit(node->statement());
745 void AstPrinter::VisitIfStatement(IfStatement* node) {
746 IndentedScope indent(this, "IF", node->position());
747 PrintIndentedVisit("CONDITION", node->condition());
748 PrintIndentedVisit("THEN", node->then_statement());
749 if (node->HasElseStatement()) {
750 PrintIndentedVisit("ELSE", node->else_statement());
755 void AstPrinter::VisitContinueStatement(ContinueStatement* node) {
756 IndentedScope indent(this, "CONTINUE", node->position());
757 PrintLabelsIndented(node->target()->labels());
761 void AstPrinter::VisitBreakStatement(BreakStatement* node) {
762 IndentedScope indent(this, "BREAK", node->position());
763 PrintLabelsIndented(node->target()->labels());
767 void AstPrinter::VisitReturnStatement(ReturnStatement* node) {
768 IndentedScope indent(this, "RETURN", node->position());
769 Visit(node->expression());
773 void AstPrinter::VisitWithStatement(WithStatement* node) {
774 IndentedScope indent(this, "WITH", node->position());
775 PrintIndentedVisit("OBJECT", node->expression());
776 PrintIndentedVisit("BODY", node->statement());
780 void AstPrinter::VisitSwitchStatement(SwitchStatement* node) {
781 IndentedScope indent(this, "SWITCH", node->position());
782 PrintLabelsIndented(node->labels());
783 PrintIndentedVisit("TAG", node->tag());
784 for (int i = 0; i < node->cases()->length(); i++) {
785 Visit(node->cases()->at(i));
802 void AstPrinter::VisitDoWhileStatement(DoWhileStatement* node) {
803 IndentedScope indent(this, "DO", node->position());
805 Print(" %d\n", node->yield_count());
806 PrintLabelsIndented(node->labels());
807 PrintIndentedVisit("BODY", node->body());
808 PrintIndentedVisit("COND", node->cond());
812 void AstPrinter::VisitWhileStatement(WhileStatement* node) {
813 IndentedScope indent(this, "WHILE", node->position());
815 Print(" %d\n", node->yield_count());
816 PrintLabelsIndented(node->labels());
817 PrintIndentedVisit("COND", node->cond());
818 PrintIndentedVisit("BODY", node->body());
822 void AstPrinter::VisitForStatement(ForStatement* node) {
823 IndentedScope indent(this, "FOR", node->position());
825 Print(" %d\n", node->yield_count());
826 PrintLabelsIndented(node->labels());
827 if (node->init()) PrintIndentedVisit("INIT", node->init());
828 if (node->cond()) PrintIndentedVisit("COND", node->cond());
829 PrintIndentedVisit("BODY", node->body());
830 if (node->next()) PrintIndentedVisit("NEXT", node->next());
834 void AstPrinter::VisitForInStatement(ForInStatement* node) {
835 IndentedScope indent(this, "FOR IN", node->position());
837 Print(" %d\n", node->yield_count());
838 PrintIndentedVisit("FOR", node->each());
839 PrintIndentedVisit("IN", node->enumerable());
840 PrintIndentedVisit("BODY", node->body());
844 void AstPrinter::VisitForOfStatement(ForOfStatement* node) {
845 IndentedScope indent(this, "FOR OF", node->position());
847 Print(" %d\n", node->yield_count());
848 PrintIndentedVisit("INIT", node->assign_iterator());
849 PrintIndentedVisit("NEXT", node->next_result());
850 PrintIndentedVisit("DONE", node->result_done());
851 PrintIndentedVisit("EACH", node->assign_each());
852 PrintIndentedVisit("BODY", node->body());
856 void AstPrinter::VisitTryCatchStatement(TryCatchStatement* node) {
857 IndentedScope indent(this, "TRY CATCH", node->position());
858 PrintTryStatement(node);
860 node->variable(),
861 node->variable()->name());
862 PrintIndentedVisit("CATCH", node->catch_block());
866 void AstPrinter::VisitTryFinallyStatement(TryFinallyStatement* node) {
867 IndentedScope indent(this, "TRY FINALLY", node->position());
868 PrintTryStatement(node);
869 PrintIndentedVisit("FINALLY", node->finally_block());
872 void AstPrinter::PrintTryStatement(TryStatement* node) {
873 PrintIndentedVisit("TRY", node->try_block());
876 switch (node->catch_prediction()) {
897 void AstPrinter::VisitDebuggerStatement(DebuggerStatement* node) {
898 IndentedScope indent(this, "DEBUGGER", node->position());
902 void AstPrinter::VisitFunctionLiteral(FunctionLiteral* node) {
903 IndentedScope indent(this, "FUNC LITERAL", node->position());
904 PrintLiteralIndented("NAME", node->name(), false);
905 PrintLiteralIndented("INFERRED NAME", node->inferred_name(), false);
906 PrintParameters(node->scope());
910 // PrintStatements(node->body());
914 void AstPrinter::VisitClassLiteral(ClassLiteral* node) {
915 IndentedScope indent(this, "CLASS LITERAL", node->position());
916 PrintLiteralIndented("NAME", node->constructor()->name(), false);
917 if (node->extends() != nullptr) {
918 PrintIndentedVisit("EXTENDS", node->extends());
920 PrintClassProperties(node->properties());
952 void AstPrinter::VisitNativeFunctionLiteral(NativeFunctionLiteral* node) {
953 IndentedScope indent(this, "NATIVE FUNC LITERAL", node->position());
954 PrintLiteralIndented("NAME", node->name(), false);
958 void AstPrinter::VisitDoExpression(DoExpression* node) {
959 IndentedScope indent(this, "DO EXPRESSION", node->position());
960 PrintStatements(node->block()->statements());
964 void AstPrinter::VisitConditional(Conditional* node) {
965 IndentedScope indent(this, "CONDITIONAL", node->position());
966 PrintIndentedVisit("CONDITION", node->condition());
967 PrintIndentedVisit("THEN", node->then_expression());
968 PrintIndentedVisit("ELSE", node->else_expression());
973 void AstPrinter::VisitLiteral(Literal* node) {
974 PrintLiteralIndented("LITERAL", node->value(), true);
978 void AstPrinter::VisitRegExpLiteral(RegExpLiteral* node) {
979 IndentedScope indent(this, "REGEXP LITERAL", node->position());
981 SNPrintF(buf, "literal_slot = %d\n", node->literal_slot().ToInt());
983 PrintLiteralIndented("PATTERN", node->pattern(), false);
985 if (node->flags() & RegExp::kGlobal) buf[i++] = 'g';
986 if (node->flags() & RegExp::kIgnoreCase) buf[i++] = 'i';
987 if (node->flags() & RegExp::kMultiline) buf[i++] = 'm';
988 if (node->flags() & RegExp::kUnicode) buf[i++] = 'u';
989 if (node->flags() & RegExp::kSticky) buf[i++] = 'y';
997 void AstPrinter::VisitObjectLiteral(ObjectLiteral* node) {
998 IndentedScope indent(this, "OBJ LITERAL", node->position());
1000 SNPrintF(buf, "literal_slot = %d\n", node->literal_slot().ToInt());
1002 PrintObjectProperties(node->properties());
1042 void AstPrinter::VisitArrayLiteral(ArrayLiteral* node) {
1043 IndentedScope indent(this, "ARRAY LITERAL", node->position());
1046 SNPrintF(buf, "literal_slot = %d\n", node->literal_slot().ToInt());
1048 if (node->values()->length() > 0) {
1049 IndentedScope indent(this, "VALUES", node->position());
1050 for (int i = 0; i < node->values()->length(); i++) {
1051 Visit(node->values()->at(i));
1057 void AstPrinter::VisitVariableProxy(VariableProxy* node) {
1060 FormatSlotNode(&buf, node, "VAR PROXY", node->VariableFeedbackSlot());
1062 if (!node->is_resolved()) {
1064 PrintLiteralWithModeIndented(buf.start(), nullptr, node->name());
1066 Variable* var = node->var();
1087 PrintLiteralWithModeIndented(buf.start(), var, node->name());
1092 void AstPrinter::VisitAssignment(Assignment* node) {
1093 IndentedScope indent(this, Token::Name(node->op()), node->position());
1094 Visit(node->target());
1095 Visit(node->value());
1099 void AstPrinter::VisitYield(Yield* node) {
1101 SNPrintF(buf, "YIELD id %d", node->yield_id());
1102 IndentedScope indent(this, buf.start(), node->position());
1103 Visit(node->expression());
1107 void AstPrinter::VisitThrow(Throw* node) {
1108 IndentedScope indent(this, "THROW", node->position());
1109 Visit(node->exception());
1113 void AstPrinter::VisitProperty(Property* node) {
1115 FormatSlotNode(&buf, node, "PROPERTY", node->PropertyFeedbackSlot());
1116 IndentedScope indent(this, buf.start(), node->position());
1118 Visit(node->obj());
1119 Literal* literal = node->key()->AsLiteral();
1123 PrintIndentedVisit("KEY", node->key());
1128 void AstPrinter::VisitCall(Call* node) {
1131 node->tail_call_mode() == TailCallMode::kAllow ? "TAIL CALL" : "CALL";
1132 FormatSlotNode(&buf, node, name, node->CallFeedbackICSlot());
1135 Visit(node->expression());
1136 PrintArguments(node->arguments());
1140 void AstPrinter::VisitCallNew(CallNew* node) {
1141 IndentedScope indent(this, "CALL NEW", node->position());
1142 Visit(node->expression());
1143 PrintArguments(node->arguments());
1147 void AstPrinter::VisitCallRuntime(CallRuntime* node) {
1149 if (node->is_jsruntime()) {
1151 buf, "CALL RUNTIME %s code = %p", node->debug_name(),
1152 static_cast<void*>(isolate_->context()->get(node->context_index())));
1154 SNPrintF(buf, "CALL RUNTIME %s", node->debug_name());
1157 IndentedScope indent(this, buf.start(), node->position());
1158 PrintArguments(node->arguments());
1162 void AstPrinter::VisitUnaryOperation(UnaryOperation* node) {
1163 IndentedScope indent(this, Token::Name(node->op()), node->position());
1164 Visit(node->expression());
1168 void AstPrinter::VisitCountOperation(CountOperation* node) {
1170 SNPrintF(buf, "%s %s", (node->is_prefix() ? "PRE" : "POST"),
1171 Token::Name(node->op()));
1172 IndentedScope indent(this, buf.start(), node->position());
1173 Visit(node->expression());
1177 void AstPrinter::VisitBinaryOperation(BinaryOperation* node) {
1178 IndentedScope indent(this, Token::Name(node->op()), node->position());
1179 Visit(node->left());
1180 Visit(node->right());
1184 void AstPrinter::VisitCompareOperation(CompareOperation* node) {
1185 node->op()), node->position());
1186 Visit(node->left());
1187 Visit(node->right());
1191 void AstPrinter::VisitSpread(Spread* node) {
1192 IndentedScope indent(this, "...", node->position());
1193 Visit(node->expression());
1197 void AstPrinter::VisitEmptyParentheses(EmptyParentheses* node) {
1198 IndentedScope indent(this, "()", node->position());
1201 void AstPrinter::VisitGetIterator(GetIterator* node) {
1202 IndentedScope indent(this, "GET-ITERATOR", node->position());
1203 Visit(node->iterable());
1206 void AstPrinter::VisitThisFunction(ThisFunction* node) {
1207 IndentedScope indent(this, "THIS-FUNCTION", node->position());
1211 void AstPrinter::VisitSuperPropertyReference(SuperPropertyReference* node) {
1212 IndentedScope indent(this, "SUPER-PROPERTY-REFERENCE", node->position());
1216 void AstPrinter::VisitSuperCallReference(SuperCallReference* node) {
1217 IndentedScope indent(this, "SUPER-CALL-REFERENCE", node->position());
1221 void AstPrinter::VisitRewritableExpression(RewritableExpression* node) {
1222 Visit(node->expression());