@@ -374,6 +374,7 @@ def on_BEGIN(statements)
374
374
375
375
start_char = find_next_statement_start ( lbrace . location . end_char )
376
376
statements . bind (
377
+ self ,
377
378
start_char ,
378
379
start_char - line_counts [ lbrace . location . start_line - 1 ] . start ,
379
380
rbrace . location . start_char ,
@@ -412,6 +413,7 @@ def on_END(statements)
412
413
413
414
start_char = find_next_statement_start ( lbrace . location . end_char )
414
415
statements . bind (
416
+ self ,
415
417
start_char ,
416
418
start_char - line_counts [ lbrace . location . start_line - 1 ] . start ,
417
419
rbrace . location . start_char ,
@@ -849,6 +851,7 @@ def on_begin(bodystmt)
849
851
end
850
852
851
853
bodystmt . bind (
854
+ self ,
852
855
find_next_statement_start ( keyword . location . end_char ) ,
853
856
keyword . location . end_column ,
854
857
end_location . end_char ,
@@ -961,7 +964,6 @@ def on_bodystmt(statements, rescue_clause, else_clause, ensure_clause)
961
964
unless statements . is_a? ( Statements )
962
965
statements =
963
966
Statements . new (
964
- self ,
965
967
body : [ statements ] ,
966
968
location : statements . location
967
969
)
@@ -991,6 +993,7 @@ def on_brace_block(block_var, statements)
991
993
992
994
start_char = find_next_statement_start ( location . end_char )
993
995
statements . bind (
996
+ self ,
994
997
start_char ,
995
998
start_char - line_counts [ location . start_line - 1 ] . start ,
996
999
rbrace . location . start_char ,
@@ -1098,6 +1101,7 @@ def on_class(constant, superclass, bodystmt)
1098
1101
start_char = find_next_statement_start ( location . end_char )
1099
1102
1100
1103
bodystmt . bind (
1104
+ self ,
1101
1105
start_char ,
1102
1106
start_char - line_counts [ location . start_line - 1 ] . start ,
1103
1107
ending . location . start_char ,
@@ -1307,6 +1311,7 @@ def on_def(name, params, bodystmt)
1307
1311
start_char = find_next_statement_start ( params . location . end_char )
1308
1312
1309
1313
bodystmt . bind (
1314
+ self ,
1310
1315
start_char ,
1311
1316
start_char - line_counts [ params . location . start_line - 1 ] . start ,
1312
1317
ending . location . start_char ,
@@ -1395,6 +1400,7 @@ def on_defs(target, operator, name, params, bodystmt)
1395
1400
start_char = find_next_statement_start ( params . location . end_char )
1396
1401
1397
1402
bodystmt . bind (
1403
+ self ,
1398
1404
start_char ,
1399
1405
start_char - line_counts [ params . location . start_line - 1 ] . start ,
1400
1406
ending . location . start_char ,
@@ -1434,6 +1440,7 @@ def on_do_block(block_var, bodystmt)
1434
1440
start_char = find_next_statement_start ( location . end_char )
1435
1441
1436
1442
bodystmt . bind (
1443
+ self ,
1437
1444
start_char ,
1438
1445
start_char - line_counts [ location . start_line - 1 ] . start ,
1439
1446
ending . location . start_char ,
@@ -1529,6 +1536,7 @@ def on_else(statements)
1529
1536
1530
1537
start_char = find_next_statement_start ( keyword . location . end_char )
1531
1538
statements . bind (
1539
+ self ,
1532
1540
start_char ,
1533
1541
start_char - line_counts [ keyword . location . start_line - 1 ] . start ,
1534
1542
ending . location . start_char ,
@@ -1554,6 +1562,7 @@ def on_elsif(predicate, statements, consequent)
1554
1562
1555
1563
start_char = find_next_statement_start ( predicate . location . end_char )
1556
1564
statements . bind (
1565
+ self ,
1557
1566
start_char ,
1558
1567
start_char - line_counts [ predicate . location . start_line - 1 ] . start ,
1559
1568
ending . location . start_char ,
@@ -1677,6 +1686,7 @@ def on_ensure(statements)
1677
1686
ending = find_keyword ( :end )
1678
1687
start_char = find_next_statement_start ( keyword . location . end_char )
1679
1688
statements . bind (
1689
+ self ,
1680
1690
start_char ,
1681
1691
start_char - line_counts [ keyword . location . start_line - 1 ] . start ,
1682
1692
ending . location . start_char ,
@@ -1817,6 +1827,7 @@ def on_for(index, collection, statements)
1817
1827
find_next_statement_start ( ( delimiter || collection ) . location . end_char )
1818
1828
1819
1829
statements . bind (
1830
+ self ,
1820
1831
start_char ,
1821
1832
start_char -
1822
1833
line_counts [ ( delimiter || collection ) . location . end_line - 1 ] . start ,
@@ -2036,6 +2047,7 @@ def on_if(predicate, statements, consequent)
2036
2047
start_char =
2037
2048
find_next_statement_start ( ( keyword || predicate ) . location . end_char )
2038
2049
statements . bind (
2050
+ self ,
2039
2051
start_char ,
2040
2052
start_char - line_counts [ predicate . location . end_line - 1 ] . start ,
2041
2053
ending . location . start_char ,
@@ -2068,8 +2080,7 @@ def on_if_mod(predicate, statement)
2068
2080
2069
2081
IfNode . new (
2070
2082
predicate : predicate ,
2071
- statements :
2072
- Statements . new ( self , body : [ statement ] , location : statement . location ) ,
2083
+ statements : Statements . new ( body : [ statement ] , location : statement . location ) ,
2073
2084
consequent : nil ,
2074
2085
location : statement . location . to ( predicate . location )
2075
2086
)
@@ -2121,6 +2132,7 @@ def on_in(pattern, statements, consequent)
2121
2132
start_char =
2122
2133
find_next_statement_start ( ( token || statements_start ) . location . end_char )
2123
2134
statements . bind (
2135
+ self ,
2124
2136
start_char ,
2125
2137
start_char -
2126
2138
line_counts [ statements_start . location . start_line - 1 ] . start ,
@@ -2303,6 +2315,7 @@ def on_lambda(params, statements)
2303
2315
2304
2316
start_char = find_next_statement_start ( opening . location . end_char )
2305
2317
statements . bind (
2318
+ self ,
2306
2319
start_char ,
2307
2320
start_char - line_counts [ opening . location . end_line - 1 ] . start ,
2308
2321
closing . location . start_char ,
@@ -2587,6 +2600,7 @@ def on_module(constant, bodystmt)
2587
2600
start_char = find_next_statement_start ( constant . location . end_char )
2588
2601
2589
2602
bodystmt . bind (
2603
+ self ,
2590
2604
start_char ,
2591
2605
start_char - line_counts [ constant . location . start_line - 1 ] . start ,
2592
2606
ending . location . start_char ,
@@ -2863,7 +2877,7 @@ def on_program(statements)
2863
2877
)
2864
2878
2865
2879
statements . body << @__end__ if @__end__
2866
- statements . bind ( 0 , 0 , source . length , last_column )
2880
+ statements . bind ( self , 0 , 0 , source . length , last_column )
2867
2881
2868
2882
program = Program . new ( statements : statements , location : location )
2869
2883
attach_comments ( program , @comments )
@@ -3197,6 +3211,7 @@ def on_rescue(exceptions, variable, statements, consequent)
3197
3211
last_node = variable || exceptions || keyword
3198
3212
start_char = find_next_statement_start ( last_node . end_char )
3199
3213
statements . bind (
3214
+ self ,
3200
3215
start_char ,
3201
3216
start_char - line_counts [ last_node . location . start_line - 1 ] . start ,
3202
3217
char_pos ,
@@ -3315,6 +3330,7 @@ def on_sclass(target, bodystmt)
3315
3330
start_char = find_next_statement_start ( target . location . end_char )
3316
3331
3317
3332
bodystmt . bind (
3333
+ self ,
3318
3334
start_char ,
3319
3335
start_char - line_counts [ target . location . start_line - 1 ] . start ,
3320
3336
ending . location . start_char ,
@@ -3369,7 +3385,6 @@ def on_stmts_add(statements, statement)
3369
3385
end
3370
3386
3371
3387
Statements . new (
3372
- self ,
3373
3388
body : statements . body << statement ,
3374
3389
location : location
3375
3390
)
@@ -3379,7 +3394,6 @@ def on_stmts_add(statements, statement)
3379
3394
# on_stmts_new: () -> Statements
3380
3395
def on_stmts_new
3381
3396
Statements . new (
3382
- self ,
3383
3397
body : [ ] ,
3384
3398
location :
3385
3399
Location . fixed ( line : lineno , char : char_pos , column : current_column )
@@ -3444,6 +3458,7 @@ def on_string_embexpr(statements)
3444
3458
embexpr_end = consume_token ( EmbExprEnd )
3445
3459
3446
3460
statements . bind (
3461
+ self ,
3447
3462
embexpr_beg . location . end_char ,
3448
3463
embexpr_beg . location . end_column ,
3449
3464
embexpr_end . location . start_char ,
@@ -3794,6 +3809,7 @@ def on_unless(predicate, statements, consequent)
3794
3809
start_char =
3795
3810
find_next_statement_start ( ( keyword || predicate ) . location . end_char )
3796
3811
statements . bind (
3812
+ self ,
3797
3813
start_char ,
3798
3814
start_char - line_counts [ predicate . location . end_line - 1 ] . start ,
3799
3815
ending . location . start_char ,
@@ -3816,7 +3832,7 @@ def on_unless_mod(predicate, statement)
3816
3832
UnlessNode . new (
3817
3833
predicate : predicate ,
3818
3834
statements :
3819
- Statements . new ( self , body : [ statement ] , location : statement . location ) ,
3835
+ Statements . new ( body : [ statement ] , location : statement . location ) ,
3820
3836
consequent : nil ,
3821
3837
location : statement . location . to ( predicate . location )
3822
3838
)
@@ -3839,6 +3855,7 @@ def on_until(predicate, statements)
3839
3855
find_next_statement_start ( ( delimiter || predicate ) . location . end_char )
3840
3856
3841
3857
statements . bind (
3858
+ self ,
3842
3859
start_char ,
3843
3860
start_char - line_counts [ predicate . location . end_line - 1 ] . start ,
3844
3861
ending . location . start_char ,
@@ -3860,7 +3877,7 @@ def on_until_mod(predicate, statement)
3860
3877
UntilNode . new (
3861
3878
predicate : predicate ,
3862
3879
statements :
3863
- Statements . new ( self , body : [ statement ] , location : statement . location ) ,
3880
+ Statements . new ( body : [ statement ] , location : statement . location ) ,
3864
3881
location : statement . location . to ( predicate . location )
3865
3882
)
3866
3883
end
@@ -3935,6 +3952,7 @@ def on_when(arguments, statements, consequent)
3935
3952
find_next_statement_start ( ( token || statements_start ) . location . end_char )
3936
3953
3937
3954
statements . bind (
3955
+ self ,
3938
3956
start_char ,
3939
3957
start_char -
3940
3958
line_counts [ statements_start . location . start_line - 1 ] . start ,
@@ -3967,6 +3985,7 @@ def on_while(predicate, statements)
3967
3985
find_next_statement_start ( ( delimiter || predicate ) . location . end_char )
3968
3986
3969
3987
statements . bind (
3988
+ self ,
3970
3989
start_char ,
3971
3990
start_char - line_counts [ predicate . location . end_line - 1 ] . start ,
3972
3991
ending . location . start_char ,
@@ -3988,7 +4007,7 @@ def on_while_mod(predicate, statement)
3988
4007
WhileNode . new (
3989
4008
predicate : predicate ,
3990
4009
statements :
3991
- Statements . new ( self , body : [ statement ] , location : statement . location ) ,
4010
+ Statements . new ( body : [ statement ] , location : statement . location ) ,
3992
4011
location : statement . location . to ( predicate . location )
3993
4012
)
3994
4013
end
0 commit comments