@@ -62,6 +62,9 @@ def p_stmt(self, args):
6262 c_stmts ::= lastc_stmt
6363 c_stmts ::= continues
6464
65+ ending_return ::= RETURN_VALUE RETURN_LAST
66+ ending_return ::= RETURN_VALUE_LAMBDA LAMBDA_MARKER
67+
6568 lastc_stmt ::= iflaststmt
6669 lastc_stmt ::= forelselaststmt
6770 lastc_stmt ::= ifelsestmtc
@@ -739,15 +742,11 @@ def p_comprehension3(self, args):
739742
740743 stmt ::= set_comp_func
741744
745+ # TODO: simplify this
742746 set_comp_func ::= BUILD_SET_0 LOAD_ARG for_iter store comp_iter
743- JUMP_BACK RETURN_VALUE RETURN_LAST
747+ JUMP_BACK ending_return
744748 set_comp_func ::= BUILD_SET_0 LOAD_ARG for_iter store comp_iter
745- JUMP_BACK RETURN_VALUE_LAMBDA LAMBDA_MARKER
746-
747- set_comp_func ::= BUILD_SET_0 LOAD_ARG for_iter store comp_iter
748- COME_FROM JUMP_BACK RETURN_VALUE RETURN_LAST
749- set_comp_func ::= BUILD_SET_0 LOAD_ARG for_iter store comp_iter
750- COME_FROM JUMP_BACK RETURN_VALUE_LAMBDA LAMBDA_MARKER
749+ COME_FROM JUMP_BACK ending_return
751750
752751 comp_body ::= dict_comp_body
753752 comp_body ::= set_comp_body
@@ -763,9 +762,7 @@ def p_dict_comp3(self, args):
763762 stmt ::= dict_comp_func
764763
765764 dict_comp_func ::= BUILD_MAP_0 LOAD_ARG for_iter store
766- comp_iter JUMP_BACK RETURN_VALUE RETURN_LAST
767- dict_comp_func ::= BUILD_MAP_0 LOAD_ARG for_iter store
768- comp_iter JUMP_BACK RETURN_VALUE_LAMBDA LAMBDA_MARKER
765+ comp_iter JUMP_BACK ending_return
769766
770767 comp_iter ::= comp_if
771768 comp_iter ::= comp_if_not
0 commit comments