@@ -869,6 +869,7 @@ def bind(cls):
869869 cls .no_partial_trailer_atom <<= attach (cls .no_partial_trailer_atom_ref , cls .method ("item_handle" ))
870870 cls .simple_assign <<= attach (cls .simple_assign_ref , cls .method ("item_handle" ))
871871 cls .expr_simple_assign <<= attach (cls .expr_simple_assign_ref , cls .method ("item_handle" ))
872+ cls .unsafe_simple_assign <<= attach (cls .unsafe_simple_assign_ref , cls .method ("item_handle" ))
872873
873874 # handle all star assignments with star_assign_item_check
874875 cls .star_assign_item <<= attach (cls .star_assign_item_ref , cls .method ("star_assign_item_check" ))
@@ -903,6 +904,16 @@ def bind(cls):
903904 cls .name_match_funcdef <<= attach (cls .name_match_funcdef_ref , cls .method ("name_match_funcdef_handle" ))
904905 cls .op_match_funcdef <<= attach (cls .op_match_funcdef_ref , cls .method ("op_match_funcdef_handle" ))
905906 cls .base_case_funcdef <<= attach (cls .base_case_funcdef_ref , cls .method ("base_case_funcdef_handle" ))
907+ cls .case_funcdef_case <<= manage (
908+ cls .case_funcdef_case_ref ,
909+ cls .method ("case_funcdef_clause_manage" ),
910+ include_in_packrat_context = False ,
911+ )
912+ cls .case_funcdef_type <<= manage (
913+ cls .case_funcdef_type_ref ,
914+ cls .method ("case_funcdef_clause_manage" ),
915+ include_in_packrat_context = False ,
916+ )
906917 cls .yield_from <<= attach (cls .yield_from_ref , cls .method ("yield_from_handle" ))
907918 cls .typedef <<= attach (cls .typedef_ref , cls .method ("typedef_handle" ))
908919 cls .typedef_default <<= attach (cls .typedef_default_ref , cls .method ("typedef_handle" ))
@@ -5276,6 +5287,12 @@ def where_stmt_handle(self, loc, tokens):
52765287
52775288 return self .wrap_passthrough (out , early = True )
52785289
5290+ @property
5291+ def in_method (self ):
5292+ """Determine if currently in a method."""
5293+ cls_context = self .current_parsing_context ("class" )
5294+ return cls_context is not None and cls_context ["name" ] is not None and cls_context ["in_method" ]
5295+
52795296 @contextmanager
52805297 def class_manage (self , original , loc , item ):
52815298 """Manage the class parsing context."""
@@ -5322,11 +5339,13 @@ def func_manage(self, original, loc, item):
53225339 if cls_context is not None :
53235340 cls_context ["in_method" ] = in_method
53245341
5325- @property
5326- def in_method (self ):
5327- """Determine if currently in a method."""
5328- cls_context = self .current_parsing_context ("class" )
5329- return cls_context is not None and cls_context ["name" ] is not None and cls_context ["in_method" ]
5342+ @contextmanager
5343+ def case_funcdef_clause_manage (self , original , loc , item ):
5344+ """Manage the scope for each case clause in a case def."""
5345+ with self .add_to_parsing_context ({
5346+ "scope" : self .get_empty_scope (),
5347+ }):
5348+ yield
53305349
53315350 @contextmanager
53325351 def has_expr_setname_manage (self , original , loc , item ):
0 commit comments