File tree 1 file changed +9
-5
lines changed
1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -2407,12 +2407,14 @@ def to_json(*opts)
2407
2407
# :call-seq:
2408
2408
# on_begin: (untyped bodystmt) -> Begin | PinnedBegin
2409
2409
def on_begin ( bodystmt )
2410
- if beginning = find_token ( Op , "^" , consume : false )
2411
- tokens . delete ( beginning )
2410
+ pin = find_token ( Op , "^" , consume : false )
2411
+
2412
+ if pin && pin . location . start_char < bodystmt . location . start_char
2413
+ tokens . delete ( pin )
2412
2414
find_token ( LParen )
2413
2415
2414
- ending = find_token ( RParen )
2415
- location = beginning . location . to ( ending . location )
2416
+ rparen = find_token ( RParen )
2417
+ location = pin . location . to ( rparen . location )
2416
2418
2417
2419
PinnedBegin . new ( statement : bodystmt , location : location )
2418
2420
else
@@ -13087,7 +13089,9 @@ def to_json(*opts)
13087
13089
# :call-seq:
13088
13090
# on_var_ref: ((Const | CVar | GVar | Ident | IVar | Kw) value) -> VarRef
13089
13091
def on_var_ref ( value )
13090
- if pin = find_token ( Op , "^" , consume : false )
13092
+ pin = find_token ( Op , "^" , consume : false )
13093
+
13094
+ if pin && pin . location . start_char == value . location . start_char - 1
13091
13095
tokens . delete ( pin )
13092
13096
PinnedVarRef . new ( value : value , location : pin . location . to ( value . location ) )
13093
13097
else
You can’t perform that action at this time.
0 commit comments