Lines Matching refs:stmt
675 validate_stmt(struct validator *state, stmt_ty stmt) in validate_stmt() argument
684 switch (stmt->kind) { in validate_stmt()
686 ret = validate_body(state, stmt->v.FunctionDef.body, "FunctionDef") && in validate_stmt()
687 validate_arguments(state, stmt->v.FunctionDef.args) && in validate_stmt()
688 validate_exprs(state, stmt->v.FunctionDef.decorator_list, Load, 0) && in validate_stmt()
689 (!stmt->v.FunctionDef.returns || in validate_stmt()
690 validate_expr(state, stmt->v.FunctionDef.returns, Load)); in validate_stmt()
693 ret = validate_body(state, stmt->v.ClassDef.body, "ClassDef") && in validate_stmt()
694 validate_exprs(state, stmt->v.ClassDef.bases, Load, 0) && in validate_stmt()
695 validate_keywords(state, stmt->v.ClassDef.keywords) && in validate_stmt()
696 validate_exprs(state, stmt->v.ClassDef.decorator_list, Load, 0); in validate_stmt()
699 ret = !stmt->v.Return.value || validate_expr(state, stmt->v.Return.value, Load); in validate_stmt()
702 ret = validate_assignlist(state, stmt->v.Delete.targets, Del); in validate_stmt()
705 ret = validate_assignlist(state, stmt->v.Assign.targets, Store) && in validate_stmt()
706 validate_expr(state, stmt->v.Assign.value, Load); in validate_stmt()
709 ret = validate_expr(state, stmt->v.AugAssign.target, Store) && in validate_stmt()
710 validate_expr(state, stmt->v.AugAssign.value, Load); in validate_stmt()
713 if (stmt->v.AnnAssign.target->kind != Name_kind && in validate_stmt()
714 stmt->v.AnnAssign.simple) { in validate_stmt()
719 ret = validate_expr(state, stmt->v.AnnAssign.target, Store) && in validate_stmt()
720 (!stmt->v.AnnAssign.value || in validate_stmt()
721 validate_expr(state, stmt->v.AnnAssign.value, Load)) && in validate_stmt()
722 validate_expr(state, stmt->v.AnnAssign.annotation, Load); in validate_stmt()
725 ret = validate_expr(state, stmt->v.For.target, Store) && in validate_stmt()
726 validate_expr(state, stmt->v.For.iter, Load) && in validate_stmt()
727 validate_body(state, stmt->v.For.body, "For") && in validate_stmt()
728 validate_stmts(state, stmt->v.For.orelse); in validate_stmt()
731 ret = validate_expr(state, stmt->v.AsyncFor.target, Store) && in validate_stmt()
732 validate_expr(state, stmt->v.AsyncFor.iter, Load) && in validate_stmt()
733 validate_body(state, stmt->v.AsyncFor.body, "AsyncFor") && in validate_stmt()
734 validate_stmts(state, stmt->v.AsyncFor.orelse); in validate_stmt()
737 ret = validate_expr(state, stmt->v.While.test, Load) && in validate_stmt()
738 validate_body(state, stmt->v.While.body, "While") && in validate_stmt()
739 validate_stmts(state, stmt->v.While.orelse); in validate_stmt()
742 ret = validate_expr(state, stmt->v.If.test, Load) && in validate_stmt()
743 validate_body(state, stmt->v.If.body, "If") && in validate_stmt()
744 validate_stmts(state, stmt->v.If.orelse); in validate_stmt()
747 if (!validate_nonempty_seq(stmt->v.With.items, "items", "With")) in validate_stmt()
749 for (i = 0; i < asdl_seq_LEN(stmt->v.With.items); i++) { in validate_stmt()
750 withitem_ty item = asdl_seq_GET(stmt->v.With.items, i); in validate_stmt()
755 ret = validate_body(state, stmt->v.With.body, "With"); in validate_stmt()
758 if (!validate_nonempty_seq(stmt->v.AsyncWith.items, "items", "AsyncWith")) in validate_stmt()
760 for (i = 0; i < asdl_seq_LEN(stmt->v.AsyncWith.items); i++) { in validate_stmt()
761 withitem_ty item = asdl_seq_GET(stmt->v.AsyncWith.items, i); in validate_stmt()
766 ret = validate_body(state, stmt->v.AsyncWith.body, "AsyncWith"); in validate_stmt()
769 if (!validate_expr(state, stmt->v.Match.subject, Load) in validate_stmt()
770 || !validate_nonempty_seq(stmt->v.Match.cases, "cases", "Match")) { in validate_stmt()
773 for (i = 0; i < asdl_seq_LEN(stmt->v.Match.cases); i++) { in validate_stmt()
774 match_case_ty m = asdl_seq_GET(stmt->v.Match.cases, i); in validate_stmt()
784 if (stmt->v.Raise.exc) { in validate_stmt()
785 ret = validate_expr(state, stmt->v.Raise.exc, Load) && in validate_stmt()
786 (!stmt->v.Raise.cause || validate_expr(state, stmt->v.Raise.cause, Load)); in validate_stmt()
789 if (stmt->v.Raise.cause) { in validate_stmt()
796 if (!validate_body(state, stmt->v.Try.body, "Try")) in validate_stmt()
798 if (!asdl_seq_LEN(stmt->v.Try.handlers) && in validate_stmt()
799 !asdl_seq_LEN(stmt->v.Try.finalbody)) { in validate_stmt()
803 if (!asdl_seq_LEN(stmt->v.Try.handlers) && in validate_stmt()
804 asdl_seq_LEN(stmt->v.Try.orelse)) { in validate_stmt()
808 for (i = 0; i < asdl_seq_LEN(stmt->v.Try.handlers); i++) { in validate_stmt()
809 excepthandler_ty handler = asdl_seq_GET(stmt->v.Try.handlers, i); in validate_stmt()
815 ret = (!asdl_seq_LEN(stmt->v.Try.finalbody) || in validate_stmt()
816 validate_stmts(state, stmt->v.Try.finalbody)) && in validate_stmt()
817 (!asdl_seq_LEN(stmt->v.Try.orelse) || in validate_stmt()
818 validate_stmts(state, stmt->v.Try.orelse)); in validate_stmt()
821 ret = validate_expr(state, stmt->v.Assert.test, Load) && in validate_stmt()
822 (!stmt->v.Assert.msg || validate_expr(state, stmt->v.Assert.msg, Load)); in validate_stmt()
825 ret = validate_nonempty_seq(stmt->v.Import.names, "names", "Import"); in validate_stmt()
828 if (stmt->v.ImportFrom.level < 0) { in validate_stmt()
832 ret = validate_nonempty_seq(stmt->v.ImportFrom.names, "names", "ImportFrom"); in validate_stmt()
835 ret = validate_nonempty_seq(stmt->v.Global.names, "names", "Global"); in validate_stmt()
838 ret = validate_nonempty_seq(stmt->v.Nonlocal.names, "names", "Nonlocal"); in validate_stmt()
841 ret = validate_expr(state, stmt->v.Expr.value, Load); in validate_stmt()
844 ret = validate_body(state, stmt->v.AsyncFunctionDef.body, "AsyncFunctionDef") && in validate_stmt()
845 validate_arguments(state, stmt->v.AsyncFunctionDef.args) && in validate_stmt()
846 validate_exprs(state, stmt->v.AsyncFunctionDef.decorator_list, Load, 0) && in validate_stmt()
847 (!stmt->v.AsyncFunctionDef.returns || in validate_stmt()
848 validate_expr(state, stmt->v.AsyncFunctionDef.returns, Load)); in validate_stmt()
870 stmt_ty stmt = asdl_seq_GET(seq, i); in validate_stmts() local
871 if (stmt) { in validate_stmts()
872 if (!validate_stmt(state, stmt)) in validate_stmts()