Lines Matching refs:node_

628 static int astfold_mod(mod_ty node_, PyArena *ctx_, _PyASTOptimizeState *state);
629 static int astfold_stmt(stmt_ty node_, PyArena *ctx_, _PyASTOptimizeState *state);
630 static int astfold_expr(expr_ty node_, PyArena *ctx_, _PyASTOptimizeState *state);
631 static int astfold_arguments(arguments_ty node_, PyArena *ctx_, _PyASTOptimizeState *state);
632 static int astfold_comprehension(comprehension_ty node_, PyArena *ctx_, _PyASTOptimizeState *state);
633 static int astfold_keyword(keyword_ty node_, PyArena *ctx_, _PyASTOptimizeState *state);
634 static int astfold_arg(arg_ty node_, PyArena *ctx_, _PyASTOptimizeState *state);
635 static int astfold_withitem(withitem_ty node_, PyArena *ctx_, _PyASTOptimizeState *state);
636 static int astfold_excepthandler(excepthandler_ty node_, PyArena *ctx_, _PyASTOptimizeState *state);
637 static int astfold_match_case(match_case_ty node_, PyArena *ctx_, _PyASTOptimizeState *state);
638 static int astfold_pattern(pattern_ty node_, PyArena *ctx_, _PyASTOptimizeState *state);
683 astfold_mod(mod_ty node_, PyArena *ctx_, _PyASTOptimizeState *state)
685 switch (node_->kind) {
687 CALL(astfold_body, asdl_seq, node_->v.Module.body);
690 CALL_SEQ(astfold_stmt, stmt, node_->v.Interactive.body);
693 CALL(astfold_expr, expr_ty, node_->v.Expression.body);
705 astfold_expr(expr_ty node_, PyArena *ctx_, _PyASTOptimizeState *state)
712 switch (node_->kind) {
714 CALL_SEQ(astfold_expr, expr, node_->v.BoolOp.values);
717 CALL(astfold_expr, expr_ty, node_->v.BinOp.left);
718 CALL(astfold_expr, expr_ty, node_->v.BinOp.right);
719 CALL(fold_binop, expr_ty, node_);
722 CALL(astfold_expr, expr_ty, node_->v.UnaryOp.operand);
723 CALL(fold_unaryop, expr_ty, node_);
726 CALL(astfold_arguments, arguments_ty, node_->v.Lambda.args);
727 CALL(astfold_expr, expr_ty, node_->v.Lambda.body);
730 CALL(astfold_expr, expr_ty, node_->v.IfExp.test);
731 CALL(astfold_expr, expr_ty, node_->v.IfExp.body);
732 CALL(astfold_expr, expr_ty, node_->v.IfExp.orelse);
735 CALL_SEQ(astfold_expr, expr, node_->v.Dict.keys);
736 CALL_SEQ(astfold_expr, expr, node_->v.Dict.values);
739 CALL_SEQ(astfold_expr, expr, node_->v.Set.elts);
742 CALL(astfold_expr, expr_ty, node_->v.ListComp.elt);
743 CALL_SEQ(astfold_comprehension, comprehension, node_->v.ListComp.generators);
746 CALL(astfold_expr, expr_ty, node_->v.SetComp.elt);
747 CALL_SEQ(astfold_comprehension, comprehension, node_->v.SetComp.generators);
750 CALL(astfold_expr, expr_ty, node_->v.DictComp.key);
751 CALL(astfold_expr, expr_ty, node_->v.DictComp.value);
752 CALL_SEQ(astfold_comprehension, comprehension, node_->v.DictComp.generators);
755 CALL(astfold_expr, expr_ty, node_->v.GeneratorExp.elt);
756 CALL_SEQ(astfold_comprehension, comprehension, node_->v.GeneratorExp.generators);
759 CALL(astfold_expr, expr_ty, node_->v.Await.value);
762 CALL_OPT(astfold_expr, expr_ty, node_->v.Yield.value);
765 CALL(astfold_expr, expr_ty, node_->v.YieldFrom.value);
768 CALL(astfold_expr, expr_ty, node_->v.Compare.left);
769 CALL_SEQ(astfold_expr, expr, node_->v.Compare.comparators);
770 CALL(fold_compare, expr_ty, node_);
773 CALL(astfold_expr, expr_ty, node_->v.Call.func);
774 CALL_SEQ(astfold_expr, expr, node_->v.Call.args);
775 CALL_SEQ(astfold_keyword, keyword, node_->v.Call.keywords);
778 CALL(astfold_expr, expr_ty, node_->v.FormattedValue.value);
779 CALL_OPT(astfold_expr, expr_ty, node_->v.FormattedValue.format_spec);
782 CALL_SEQ(astfold_expr, expr, node_->v.JoinedStr.values);
785 CALL(astfold_expr, expr_ty, node_->v.Attribute.value);
788 CALL(astfold_expr, expr_ty, node_->v.Subscript.value);
789 CALL(astfold_expr, expr_ty, node_->v.Subscript.slice);
790 CALL(fold_subscr, expr_ty, node_);
793 CALL(astfold_expr, expr_ty, node_->v.Starred.value);
796 CALL_OPT(astfold_expr, expr_ty, node_->v.Slice.lower);
797 CALL_OPT(astfold_expr, expr_ty, node_->v.Slice.upper);
798 CALL_OPT(astfold_expr, expr_ty, node_->v.Slice.step);
801 CALL_SEQ(astfold_expr, expr, node_->v.List.elts);
804 CALL_SEQ(astfold_expr, expr, node_->v.Tuple.elts);
805 CALL(fold_tuple, expr_ty, node_);
808 if (node_->v.Name.ctx == Load &&
809 _PyUnicode_EqualToASCIIString(node_->v.Name.id, "__debug__")) {
811 return make_const(node_, PyBool_FromLong(!state->optimize), ctx_);
815 CALL(astfold_expr, expr_ty, node_->v.NamedExpr.value);
828 astfold_keyword(keyword_ty node_, PyArena *ctx_, _PyASTOptimizeState *state)
830 CALL(astfold_expr, expr_ty, node_->value);
835 astfold_comprehension(comprehension_ty node_, PyArena *ctx_, _PyASTOptimizeState *state)
837 CALL(astfold_expr, expr_ty, node_->target);
838 CALL(astfold_expr, expr_ty, node_->iter);
839 CALL_SEQ(astfold_expr, expr, node_->ifs);
841 CALL(fold_iter, expr_ty, node_->iter);
846 astfold_arguments(arguments_ty node_, PyArena *ctx_, _PyASTOptimizeState *state)
848 CALL_SEQ(astfold_arg, arg, node_->posonlyargs);
849 CALL_SEQ(astfold_arg, arg, node_->args);
850 CALL_OPT(astfold_arg, arg_ty, node_->vararg);
851 CALL_SEQ(astfold_arg, arg, node_->kwonlyargs);
852 CALL_SEQ(astfold_expr, expr, node_->kw_defaults);
853 CALL_OPT(astfold_arg, arg_ty, node_->kwarg);
854 CALL_SEQ(astfold_expr, expr, node_->defaults);
859 astfold_arg(arg_ty node_, PyArena *ctx_, _PyASTOptimizeState *state)
862 CALL_OPT(astfold_expr, expr_ty, node_->annotation);
868 astfold_stmt(stmt_ty node_, PyArena *ctx_, _PyASTOptimizeState *state)
875 switch (node_->kind) {
877 CALL(astfold_arguments, arguments_ty, node_->v.FunctionDef.args);
878 CALL(astfold_body, asdl_seq, node_->v.FunctionDef.body);
879 CALL_SEQ(astfold_expr, expr, node_->v.FunctionDef.decorator_list);
881 CALL_OPT(astfold_expr, expr_ty, node_->v.FunctionDef.returns);
885 CALL(astfold_arguments, arguments_ty, node_->v.AsyncFunctionDef.args);
886 CALL(astfold_body, asdl_seq, node_->v.AsyncFunctionDef.body);
887 CALL_SEQ(astfold_expr, expr, node_->v.AsyncFunctionDef.decorator_list);
889 CALL_OPT(astfold_expr, expr_ty, node_->v.AsyncFunctionDef.returns);
893 CALL_SEQ(astfold_expr, expr, node_->v.ClassDef.bases);
894 CALL_SEQ(astfold_keyword, keyword, node_->v.ClassDef.keywords);
895 CALL(astfold_body, asdl_seq, node_->v.ClassDef.body);
896 CALL_SEQ(astfold_expr, expr, node_->v.ClassDef.decorator_list);
899 CALL_OPT(astfold_expr, expr_ty, node_->v.Return.value);
902 CALL_SEQ(astfold_expr, expr, node_->v.Delete.targets);
905 CALL_SEQ(astfold_expr, expr, node_->v.Assign.targets);
906 CALL(astfold_expr, expr_ty, node_->v.Assign.value);
909 CALL(astfold_expr, expr_ty, node_->v.AugAssign.target);
910 CALL(astfold_expr, expr_ty, node_->v.AugAssign.value);
913 CALL(astfold_expr, expr_ty, node_->v.AnnAssign.target);
915 CALL(astfold_expr, expr_ty, node_->v.AnnAssign.annotation);
917 CALL_OPT(astfold_expr, expr_ty, node_->v.AnnAssign.value);
920 CALL(astfold_expr, expr_ty, node_->v.For.target);
921 CALL(astfold_expr, expr_ty, node_->v.For.iter);
922 CALL_SEQ(astfold_stmt, stmt, node_->v.For.body);
923 CALL_SEQ(astfold_stmt, stmt, node_->v.For.orelse);
925 CALL(fold_iter, expr_ty, node_->v.For.iter);
928 CALL(astfold_expr, expr_ty, node_->v.AsyncFor.target);
929 CALL(astfold_expr, expr_ty, node_->v.AsyncFor.iter);
930 CALL_SEQ(astfold_stmt, stmt, node_->v.AsyncFor.body);
931 CALL_SEQ(astfold_stmt, stmt, node_->v.AsyncFor.orelse);
934 CALL(astfold_expr, expr_ty, node_->v.While.test);
935 CALL_SEQ(astfold_stmt, stmt, node_->v.While.body);
936 CALL_SEQ(astfold_stmt, stmt, node_->v.While.orelse);
939 CALL(astfold_expr, expr_ty, node_->v.If.test);
940 CALL_SEQ(astfold_stmt, stmt, node_->v.If.body);
941 CALL_SEQ(astfold_stmt, stmt, node_->v.If.orelse);
944 CALL_SEQ(astfold_withitem, withitem, node_->v.With.items);
945 CALL_SEQ(astfold_stmt, stmt, node_->v.With.body);
948 CALL_SEQ(astfold_withitem, withitem, node_->v.AsyncWith.items);
949 CALL_SEQ(astfold_stmt, stmt, node_->v.AsyncWith.body);
952 CALL_OPT(astfold_expr, expr_ty, node_->v.Raise.exc);
953 CALL_OPT(astfold_expr, expr_ty, node_->v.Raise.cause);
956 CALL_SEQ(astfold_stmt, stmt, node_->v.Try.body);
957 CALL_SEQ(astfold_excepthandler, excepthandler, node_->v.Try.handlers);
958 CALL_SEQ(astfold_stmt, stmt, node_->v.Try.orelse);
959 CALL_SEQ(astfold_stmt, stmt, node_->v.Try.finalbody);
962 CALL_SEQ(astfold_stmt, stmt, node_->v.TryStar.body);
963 CALL_SEQ(astfold_excepthandler, excepthandler, node_->v.TryStar.handlers);
964 CALL_SEQ(astfold_stmt, stmt, node_->v.TryStar.orelse);
965 CALL_SEQ(astfold_stmt, stmt, node_->v.TryStar.finalbody);
968 CALL(astfold_expr, expr_ty, node_->v.Assert.test);
969 CALL_OPT(astfold_expr, expr_ty, node_->v.Assert.msg);
972 CALL(astfold_expr, expr_ty, node_->v.Expr.value);
975 CALL(astfold_expr, expr_ty, node_->v.Match.subject);
976 CALL_SEQ(astfold_match_case, match_case, node_->v.Match.cases);
995 astfold_excepthandler(excepthandler_ty node_, PyArena *ctx_, _PyASTOptimizeState *state)
997 switch (node_->kind) {
999 CALL_OPT(astfold_expr, expr_ty, node_->v.ExceptHandler.type);
1000 CALL_SEQ(astfold_stmt, stmt, node_->v.ExceptHandler.body);
1009 astfold_withitem(withitem_ty node_, PyArena *ctx_, _PyASTOptimizeState *state)
1011 CALL(astfold_expr, expr_ty, node_->context_expr);
1012 CALL_OPT(astfold_expr, expr_ty, node_->optional_vars);
1017 astfold_pattern(pattern_ty node_, PyArena *ctx_, _PyASTOptimizeState *state)
1027 switch (node_->kind) {
1029 CALL(astfold_expr, expr_ty, node_->v.MatchValue.value);
1034 CALL_SEQ(astfold_pattern, pattern, node_->v.MatchSequence.patterns);
1037 CALL_SEQ(astfold_expr, expr, node_->v.MatchMapping.keys);
1038 CALL_SEQ(astfold_pattern, pattern, node_->v.MatchMapping.patterns);
1041 CALL(astfold_expr, expr_ty, node_->v.MatchClass.cls);
1042 CALL_SEQ(astfold_pattern, pattern, node_->v.MatchClass.patterns);
1043 CALL_SEQ(astfold_pattern, pattern, node_->v.MatchClass.kwd_patterns);
1048 if (node_->v.MatchAs.pattern) {
1049 CALL(astfold_pattern, pattern_ty, node_->v.MatchAs.pattern);
1053 CALL_SEQ(astfold_pattern, pattern, node_->v.MatchOr.patterns);
1063 astfold_match_case(match_case_ty node_, PyArena *ctx_, _PyASTOptimizeState *state)
1065 CALL(astfold_pattern, expr_ty, node_->pattern);
1066 CALL_OPT(astfold_expr, expr_ty, node_->guard);
1067 CALL_SEQ(astfold_stmt, stmt, node_->body);