@@ -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 ,
@@ -960,11 +963,7 @@ def on_bodystmt(statements, rescue_clause, else_clause, ensure_clause)
960
963
# case we'll wrap it in a Statements node to be consistent.
961
964
unless statements . is_a? ( Statements )
962
965
statements =
963
- Statements . new (
964
- self ,
965
- body : [ statements ] ,
966
- location : statements . location
967
- )
966
+ Statements . new ( body : [ statements ] , location : statements . location )
968
967
end
969
968
970
969
parts = [ statements , rescue_clause , else_clause , ensure_clause ] . compact
@@ -991,6 +990,7 @@ def on_brace_block(block_var, statements)
991
990
992
991
start_char = find_next_statement_start ( location . end_char )
993
992
statements . bind (
993
+ self ,
994
994
start_char ,
995
995
start_char - line_counts [ location . start_line - 1 ] . start ,
996
996
rbrace . location . start_char ,
@@ -1098,6 +1098,7 @@ def on_class(constant, superclass, bodystmt)
1098
1098
start_char = find_next_statement_start ( location . end_char )
1099
1099
1100
1100
bodystmt . bind (
1101
+ self ,
1101
1102
start_char ,
1102
1103
start_char - line_counts [ location . start_line - 1 ] . start ,
1103
1104
ending . location . start_char ,
@@ -1307,6 +1308,7 @@ def on_def(name, params, bodystmt)
1307
1308
start_char = find_next_statement_start ( params . location . end_char )
1308
1309
1309
1310
bodystmt . bind (
1311
+ self ,
1310
1312
start_char ,
1311
1313
start_char - line_counts [ params . location . start_line - 1 ] . start ,
1312
1314
ending . location . start_char ,
@@ -1395,6 +1397,7 @@ def on_defs(target, operator, name, params, bodystmt)
1395
1397
start_char = find_next_statement_start ( params . location . end_char )
1396
1398
1397
1399
bodystmt . bind (
1400
+ self ,
1398
1401
start_char ,
1399
1402
start_char - line_counts [ params . location . start_line - 1 ] . start ,
1400
1403
ending . location . start_char ,
@@ -1434,6 +1437,7 @@ def on_do_block(block_var, bodystmt)
1434
1437
start_char = find_next_statement_start ( location . end_char )
1435
1438
1436
1439
bodystmt . bind (
1440
+ self ,
1437
1441
start_char ,
1438
1442
start_char - line_counts [ location . start_line - 1 ] . start ,
1439
1443
ending . location . start_char ,
@@ -1529,6 +1533,7 @@ def on_else(statements)
1529
1533
1530
1534
start_char = find_next_statement_start ( keyword . location . end_char )
1531
1535
statements . bind (
1536
+ self ,
1532
1537
start_char ,
1533
1538
start_char - line_counts [ keyword . location . start_line - 1 ] . start ,
1534
1539
ending . location . start_char ,
@@ -1554,6 +1559,7 @@ def on_elsif(predicate, statements, consequent)
1554
1559
1555
1560
start_char = find_next_statement_start ( predicate . location . end_char )
1556
1561
statements . bind (
1562
+ self ,
1557
1563
start_char ,
1558
1564
start_char - line_counts [ predicate . location . start_line - 1 ] . start ,
1559
1565
ending . location . start_char ,
@@ -1677,6 +1683,7 @@ def on_ensure(statements)
1677
1683
ending = find_keyword ( :end )
1678
1684
start_char = find_next_statement_start ( keyword . location . end_char )
1679
1685
statements . bind (
1686
+ self ,
1680
1687
start_char ,
1681
1688
start_char - line_counts [ keyword . location . start_line - 1 ] . start ,
1682
1689
ending . location . start_char ,
@@ -1817,6 +1824,7 @@ def on_for(index, collection, statements)
1817
1824
find_next_statement_start ( ( delimiter || collection ) . location . end_char )
1818
1825
1819
1826
statements . bind (
1827
+ self ,
1820
1828
start_char ,
1821
1829
start_char -
1822
1830
line_counts [ ( delimiter || collection ) . location . end_line - 1 ] . start ,
@@ -2036,6 +2044,7 @@ def on_if(predicate, statements, consequent)
2036
2044
start_char =
2037
2045
find_next_statement_start ( ( keyword || predicate ) . location . end_char )
2038
2046
statements . bind (
2047
+ self ,
2039
2048
start_char ,
2040
2049
start_char - line_counts [ predicate . location . end_line - 1 ] . start ,
2041
2050
ending . location . start_char ,
@@ -2069,7 +2078,7 @@ def on_if_mod(predicate, statement)
2069
2078
IfNode . new (
2070
2079
predicate : predicate ,
2071
2080
statements :
2072
- Statements . new ( self , body : [ statement ] , location : statement . location ) ,
2081
+ Statements . new ( body : [ statement ] , location : statement . location ) ,
2073
2082
consequent : nil ,
2074
2083
location : statement . location . to ( predicate . location )
2075
2084
)
@@ -2121,6 +2130,7 @@ def on_in(pattern, statements, consequent)
2121
2130
start_char =
2122
2131
find_next_statement_start ( ( token || statements_start ) . location . end_char )
2123
2132
statements . bind (
2133
+ self ,
2124
2134
start_char ,
2125
2135
start_char -
2126
2136
line_counts [ statements_start . location . start_line - 1 ] . start ,
@@ -2303,6 +2313,7 @@ def on_lambda(params, statements)
2303
2313
2304
2314
start_char = find_next_statement_start ( opening . location . end_char )
2305
2315
statements . bind (
2316
+ self ,
2306
2317
start_char ,
2307
2318
start_char - line_counts [ opening . location . end_line - 1 ] . start ,
2308
2319
closing . location . start_char ,
@@ -2587,6 +2598,7 @@ def on_module(constant, bodystmt)
2587
2598
start_char = find_next_statement_start ( constant . location . end_char )
2588
2599
2589
2600
bodystmt . bind (
2601
+ self ,
2590
2602
start_char ,
2591
2603
start_char - line_counts [ constant . location . start_line - 1 ] . start ,
2592
2604
ending . location . start_char ,
@@ -2863,7 +2875,7 @@ def on_program(statements)
2863
2875
)
2864
2876
2865
2877
statements . body << @__end__ if @__end__
2866
- statements . bind ( 0 , 0 , source . length , last_column )
2878
+ statements . bind ( self , 0 , 0 , source . length , last_column )
2867
2879
2868
2880
program = Program . new ( statements : statements , location : location )
2869
2881
attach_comments ( program , @comments )
@@ -3197,6 +3209,7 @@ def on_rescue(exceptions, variable, statements, consequent)
3197
3209
last_node = variable || exceptions || keyword
3198
3210
start_char = find_next_statement_start ( last_node . end_char )
3199
3211
statements . bind (
3212
+ self ,
3200
3213
start_char ,
3201
3214
start_char - line_counts [ last_node . location . start_line - 1 ] . start ,
3202
3215
char_pos ,
@@ -3315,6 +3328,7 @@ def on_sclass(target, bodystmt)
3315
3328
start_char = find_next_statement_start ( target . location . end_char )
3316
3329
3317
3330
bodystmt . bind (
3331
+ self ,
3318
3332
start_char ,
3319
3333
start_char - line_counts [ target . location . start_line - 1 ] . start ,
3320
3334
ending . location . start_char ,
@@ -3368,18 +3382,13 @@ def on_stmts_add(statements, statement)
3368
3382
statements . location . to ( statement . location )
3369
3383
end
3370
3384
3371
- Statements . new (
3372
- self ,
3373
- body : statements . body << statement ,
3374
- location : location
3375
- )
3385
+ Statements . new ( body : statements . body << statement , location : location )
3376
3386
end
3377
3387
3378
3388
# :call-seq:
3379
3389
# on_stmts_new: () -> Statements
3380
3390
def on_stmts_new
3381
3391
Statements . new (
3382
- self ,
3383
3392
body : [ ] ,
3384
3393
location :
3385
3394
Location . fixed ( line : lineno , char : char_pos , column : current_column )
@@ -3444,6 +3453,7 @@ def on_string_embexpr(statements)
3444
3453
embexpr_end = consume_token ( EmbExprEnd )
3445
3454
3446
3455
statements . bind (
3456
+ self ,
3447
3457
embexpr_beg . location . end_char ,
3448
3458
embexpr_beg . location . end_column ,
3449
3459
embexpr_end . location . start_char ,
@@ -3794,6 +3804,7 @@ def on_unless(predicate, statements, consequent)
3794
3804
start_char =
3795
3805
find_next_statement_start ( ( keyword || predicate ) . location . end_char )
3796
3806
statements . bind (
3807
+ self ,
3797
3808
start_char ,
3798
3809
start_char - line_counts [ predicate . location . end_line - 1 ] . start ,
3799
3810
ending . location . start_char ,
@@ -3816,7 +3827,7 @@ def on_unless_mod(predicate, statement)
3816
3827
UnlessNode . new (
3817
3828
predicate : predicate ,
3818
3829
statements :
3819
- Statements . new ( self , body : [ statement ] , location : statement . location ) ,
3830
+ Statements . new ( body : [ statement ] , location : statement . location ) ,
3820
3831
consequent : nil ,
3821
3832
location : statement . location . to ( predicate . location )
3822
3833
)
@@ -3839,6 +3850,7 @@ def on_until(predicate, statements)
3839
3850
find_next_statement_start ( ( delimiter || predicate ) . location . end_char )
3840
3851
3841
3852
statements . bind (
3853
+ self ,
3842
3854
start_char ,
3843
3855
start_char - line_counts [ predicate . location . end_line - 1 ] . start ,
3844
3856
ending . location . start_char ,
@@ -3860,7 +3872,7 @@ def on_until_mod(predicate, statement)
3860
3872
UntilNode . new (
3861
3873
predicate : predicate ,
3862
3874
statements :
3863
- Statements . new ( self , body : [ statement ] , location : statement . location ) ,
3875
+ Statements . new ( body : [ statement ] , location : statement . location ) ,
3864
3876
location : statement . location . to ( predicate . location )
3865
3877
)
3866
3878
end
@@ -3935,6 +3947,7 @@ def on_when(arguments, statements, consequent)
3935
3947
find_next_statement_start ( ( token || statements_start ) . location . end_char )
3936
3948
3937
3949
statements . bind (
3950
+ self ,
3938
3951
start_char ,
3939
3952
start_char -
3940
3953
line_counts [ statements_start . location . start_line - 1 ] . start ,
@@ -3967,6 +3980,7 @@ def on_while(predicate, statements)
3967
3980
find_next_statement_start ( ( delimiter || predicate ) . location . end_char )
3968
3981
3969
3982
statements . bind (
3983
+ self ,
3970
3984
start_char ,
3971
3985
start_char - line_counts [ predicate . location . end_line - 1 ] . start ,
3972
3986
ending . location . start_char ,
@@ -3988,7 +4002,7 @@ def on_while_mod(predicate, statement)
3988
4002
WhileNode . new (
3989
4003
predicate : predicate ,
3990
4004
statements :
3991
- Statements . new ( self , body : [ statement ] , location : statement . location ) ,
4005
+ Statements . new ( body : [ statement ] , location : statement . location ) ,
3992
4006
location : statement . location . to ( predicate . location )
3993
4007
)
3994
4008
end
0 commit comments