@@ -2528,6 +2528,7 @@ def p_IF_statement(s: PyrexScanner, ctx):
2528
2528
@cython .cfunc
2529
2529
def p_statement (s : PyrexScanner , ctx , first_statement : cython .bint = 0 ):
2530
2530
cdef_flag = ctx .cdef_flag
2531
+ pos = s .position ()
2531
2532
decorators = None
2532
2533
if s .sy == 'ctypedef' :
2533
2534
if ctx .level not in ('module' , 'module_pxd' ):
@@ -2577,7 +2578,7 @@ def p_statement(s: PyrexScanner, ctx, first_statement: cython.bint = 0):
2577
2578
if ctx .level not in ('module' , 'module_pxd' , 'function' , 'c_class' , 'c_class_pxd' ):
2578
2579
s .error ('cdef statement not allowed here' )
2579
2580
s .level = ctx .level
2580
- node = p_cdef_statement (s , ctx (overridable = overridable ))
2581
+ node = p_cdef_statement (s , pos , ctx (overridable = overridable ))
2581
2582
if decorators is not None :
2582
2583
tup = (Nodes .CFuncDefNode , Nodes .CVarDefNode , Nodes .CClassDefNode )
2583
2584
if ctx .allow_struct_enum_decorator :
@@ -3461,8 +3462,7 @@ def p_api(s: PyrexScanner) -> cython.bint:
3461
3462
3462
3463
3463
3464
@cython .cfunc
3464
- def p_cdef_statement (s : PyrexScanner , ctx ):
3465
- pos = s .position ()
3465
+ def p_cdef_statement (s : PyrexScanner , pos , ctx ):
3466
3466
ctx .visibility = p_visibility (s , ctx .visibility )
3467
3467
ctx .api = ctx .api or p_api (s )
3468
3468
if ctx .api :
@@ -4301,20 +4301,21 @@ def p_cpp_class_definition(s: PyrexScanner, pos, ctx):
4301
4301
4302
4302
@cython .cfunc
4303
4303
def p_cpp_class_attribute (s : PyrexScanner , ctx ):
4304
+ pos = s .position ()
4304
4305
decorators = None
4305
4306
if s .sy == '@' :
4306
4307
decorators = p_decorators (s )
4307
4308
if s .systring == 'cppclass' :
4308
- return p_cpp_class_definition (s , s . position () , ctx )
4309
+ return p_cpp_class_definition (s , pos , ctx )
4309
4310
elif s .systring == 'ctypedef' :
4310
4311
return p_ctypedef_statement (s , ctx )
4311
4312
elif s .sy == 'IDENT' and s .systring in struct_enum_union :
4312
4313
if s .systring != 'enum' :
4313
- return p_cpp_class_definition (s , s . position () , ctx )
4314
+ return p_cpp_class_definition (s , pos , ctx )
4314
4315
else :
4315
- return p_struct_enum (s , s . position () , ctx )
4316
+ return p_struct_enum (s , pos , ctx )
4316
4317
else :
4317
- node = p_c_func_or_var_declaration (s , s . position () , ctx )
4318
+ node = p_c_func_or_var_declaration (s , pos , ctx )
4318
4319
if decorators is not None :
4319
4320
tup = Nodes .CFuncDefNode , Nodes .CVarDefNode , Nodes .CClassDefNode
4320
4321
if ctx .allow_struct_enum_decorator :
0 commit comments