@@ -374,6 +374,7 @@ def on_BEGIN(statements)
374374
375375 start_char = find_next_statement_start ( lbrace . location . end_char )
376376 statements . bind (
377+ self ,
377378 start_char ,
378379 start_char - line_counts [ lbrace . location . start_line - 1 ] . start ,
379380 rbrace . location . start_char ,
@@ -412,6 +413,7 @@ def on_END(statements)
412413
413414 start_char = find_next_statement_start ( lbrace . location . end_char )
414415 statements . bind (
416+ self ,
415417 start_char ,
416418 start_char - line_counts [ lbrace . location . start_line - 1 ] . start ,
417419 rbrace . location . start_char ,
@@ -849,6 +851,7 @@ def on_begin(bodystmt)
849851 end
850852
851853 bodystmt . bind (
854+ self ,
852855 find_next_statement_start ( keyword . location . end_char ) ,
853856 keyword . location . end_column ,
854857 end_location . end_char ,
@@ -960,11 +963,7 @@ def on_bodystmt(statements, rescue_clause, else_clause, ensure_clause)
960963 # case we'll wrap it in a Statements node to be consistent.
961964 unless statements . is_a? ( Statements )
962965 statements =
963- Statements . new (
964- self ,
965- body : [ statements ] ,
966- location : statements . location
967- )
966+ Statements . new ( body : [ statements ] , location : statements . location )
968967 end
969968
970969 parts = [ statements , rescue_clause , else_clause , ensure_clause ] . compact
@@ -991,6 +990,7 @@ def on_brace_block(block_var, statements)
991990
992991 start_char = find_next_statement_start ( location . end_char )
993992 statements . bind (
993+ self ,
994994 start_char ,
995995 start_char - line_counts [ location . start_line - 1 ] . start ,
996996 rbrace . location . start_char ,
@@ -1098,6 +1098,7 @@ def on_class(constant, superclass, bodystmt)
10981098 start_char = find_next_statement_start ( location . end_char )
10991099
11001100 bodystmt . bind (
1101+ self ,
11011102 start_char ,
11021103 start_char - line_counts [ location . start_line - 1 ] . start ,
11031104 ending . location . start_char ,
@@ -1307,6 +1308,7 @@ def on_def(name, params, bodystmt)
13071308 start_char = find_next_statement_start ( params . location . end_char )
13081309
13091310 bodystmt . bind (
1311+ self ,
13101312 start_char ,
13111313 start_char - line_counts [ params . location . start_line - 1 ] . start ,
13121314 ending . location . start_char ,
@@ -1395,6 +1397,7 @@ def on_defs(target, operator, name, params, bodystmt)
13951397 start_char = find_next_statement_start ( params . location . end_char )
13961398
13971399 bodystmt . bind (
1400+ self ,
13981401 start_char ,
13991402 start_char - line_counts [ params . location . start_line - 1 ] . start ,
14001403 ending . location . start_char ,
@@ -1434,6 +1437,7 @@ def on_do_block(block_var, bodystmt)
14341437 start_char = find_next_statement_start ( location . end_char )
14351438
14361439 bodystmt . bind (
1440+ self ,
14371441 start_char ,
14381442 start_char - line_counts [ location . start_line - 1 ] . start ,
14391443 ending . location . start_char ,
@@ -1529,6 +1533,7 @@ def on_else(statements)
15291533
15301534 start_char = find_next_statement_start ( keyword . location . end_char )
15311535 statements . bind (
1536+ self ,
15321537 start_char ,
15331538 start_char - line_counts [ keyword . location . start_line - 1 ] . start ,
15341539 ending . location . start_char ,
@@ -1554,6 +1559,7 @@ def on_elsif(predicate, statements, consequent)
15541559
15551560 start_char = find_next_statement_start ( predicate . location . end_char )
15561561 statements . bind (
1562+ self ,
15571563 start_char ,
15581564 start_char - line_counts [ predicate . location . start_line - 1 ] . start ,
15591565 ending . location . start_char ,
@@ -1677,6 +1683,7 @@ def on_ensure(statements)
16771683 ending = find_keyword ( :end )
16781684 start_char = find_next_statement_start ( keyword . location . end_char )
16791685 statements . bind (
1686+ self ,
16801687 start_char ,
16811688 start_char - line_counts [ keyword . location . start_line - 1 ] . start ,
16821689 ending . location . start_char ,
@@ -1817,6 +1824,7 @@ def on_for(index, collection, statements)
18171824 find_next_statement_start ( ( delimiter || collection ) . location . end_char )
18181825
18191826 statements . bind (
1827+ self ,
18201828 start_char ,
18211829 start_char -
18221830 line_counts [ ( delimiter || collection ) . location . end_line - 1 ] . start ,
@@ -2036,6 +2044,7 @@ def on_if(predicate, statements, consequent)
20362044 start_char =
20372045 find_next_statement_start ( ( keyword || predicate ) . location . end_char )
20382046 statements . bind (
2047+ self ,
20392048 start_char ,
20402049 start_char - line_counts [ predicate . location . end_line - 1 ] . start ,
20412050 ending . location . start_char ,
@@ -2069,7 +2078,7 @@ def on_if_mod(predicate, statement)
20692078 IfNode . new (
20702079 predicate : predicate ,
20712080 statements :
2072- Statements . new ( self , body : [ statement ] , location : statement . location ) ,
2081+ Statements . new ( body : [ statement ] , location : statement . location ) ,
20732082 consequent : nil ,
20742083 location : statement . location . to ( predicate . location )
20752084 )
@@ -2121,6 +2130,7 @@ def on_in(pattern, statements, consequent)
21212130 start_char =
21222131 find_next_statement_start ( ( token || statements_start ) . location . end_char )
21232132 statements . bind (
2133+ self ,
21242134 start_char ,
21252135 start_char -
21262136 line_counts [ statements_start . location . start_line - 1 ] . start ,
@@ -2303,6 +2313,7 @@ def on_lambda(params, statements)
23032313
23042314 start_char = find_next_statement_start ( opening . location . end_char )
23052315 statements . bind (
2316+ self ,
23062317 start_char ,
23072318 start_char - line_counts [ opening . location . end_line - 1 ] . start ,
23082319 closing . location . start_char ,
@@ -2587,6 +2598,7 @@ def on_module(constant, bodystmt)
25872598 start_char = find_next_statement_start ( constant . location . end_char )
25882599
25892600 bodystmt . bind (
2601+ self ,
25902602 start_char ,
25912603 start_char - line_counts [ constant . location . start_line - 1 ] . start ,
25922604 ending . location . start_char ,
@@ -2863,7 +2875,7 @@ def on_program(statements)
28632875 )
28642876
28652877 statements . body << @__end__ if @__end__
2866- statements . bind ( 0 , 0 , source . length , last_column )
2878+ statements . bind ( self , 0 , 0 , source . length , last_column )
28672879
28682880 program = Program . new ( statements : statements , location : location )
28692881 attach_comments ( program , @comments )
@@ -3197,6 +3209,7 @@ def on_rescue(exceptions, variable, statements, consequent)
31973209 last_node = variable || exceptions || keyword
31983210 start_char = find_next_statement_start ( last_node . end_char )
31993211 statements . bind (
3212+ self ,
32003213 start_char ,
32013214 start_char - line_counts [ last_node . location . start_line - 1 ] . start ,
32023215 char_pos ,
@@ -3315,6 +3328,7 @@ def on_sclass(target, bodystmt)
33153328 start_char = find_next_statement_start ( target . location . end_char )
33163329
33173330 bodystmt . bind (
3331+ self ,
33183332 start_char ,
33193333 start_char - line_counts [ target . location . start_line - 1 ] . start ,
33203334 ending . location . start_char ,
@@ -3368,18 +3382,13 @@ def on_stmts_add(statements, statement)
33683382 statements . location . to ( statement . location )
33693383 end
33703384
3371- Statements . new (
3372- self ,
3373- body : statements . body << statement ,
3374- location : location
3375- )
3385+ Statements . new ( body : statements . body << statement , location : location )
33763386 end
33773387
33783388 # :call-seq:
33793389 # on_stmts_new: () -> Statements
33803390 def on_stmts_new
33813391 Statements . new (
3382- self ,
33833392 body : [ ] ,
33843393 location :
33853394 Location . fixed ( line : lineno , char : char_pos , column : current_column )
@@ -3444,6 +3453,7 @@ def on_string_embexpr(statements)
34443453 embexpr_end = consume_token ( EmbExprEnd )
34453454
34463455 statements . bind (
3456+ self ,
34473457 embexpr_beg . location . end_char ,
34483458 embexpr_beg . location . end_column ,
34493459 embexpr_end . location . start_char ,
@@ -3794,6 +3804,7 @@ def on_unless(predicate, statements, consequent)
37943804 start_char =
37953805 find_next_statement_start ( ( keyword || predicate ) . location . end_char )
37963806 statements . bind (
3807+ self ,
37973808 start_char ,
37983809 start_char - line_counts [ predicate . location . end_line - 1 ] . start ,
37993810 ending . location . start_char ,
@@ -3816,7 +3827,7 @@ def on_unless_mod(predicate, statement)
38163827 UnlessNode . new (
38173828 predicate : predicate ,
38183829 statements :
3819- Statements . new ( self , body : [ statement ] , location : statement . location ) ,
3830+ Statements . new ( body : [ statement ] , location : statement . location ) ,
38203831 consequent : nil ,
38213832 location : statement . location . to ( predicate . location )
38223833 )
@@ -3839,6 +3850,7 @@ def on_until(predicate, statements)
38393850 find_next_statement_start ( ( delimiter || predicate ) . location . end_char )
38403851
38413852 statements . bind (
3853+ self ,
38423854 start_char ,
38433855 start_char - line_counts [ predicate . location . end_line - 1 ] . start ,
38443856 ending . location . start_char ,
@@ -3860,7 +3872,7 @@ def on_until_mod(predicate, statement)
38603872 UntilNode . new (
38613873 predicate : predicate ,
38623874 statements :
3863- Statements . new ( self , body : [ statement ] , location : statement . location ) ,
3875+ Statements . new ( body : [ statement ] , location : statement . location ) ,
38643876 location : statement . location . to ( predicate . location )
38653877 )
38663878 end
@@ -3935,6 +3947,7 @@ def on_when(arguments, statements, consequent)
39353947 find_next_statement_start ( ( token || statements_start ) . location . end_char )
39363948
39373949 statements . bind (
3950+ self ,
39383951 start_char ,
39393952 start_char -
39403953 line_counts [ statements_start . location . start_line - 1 ] . start ,
@@ -3967,6 +3980,7 @@ def on_while(predicate, statements)
39673980 find_next_statement_start ( ( delimiter || predicate ) . location . end_char )
39683981
39693982 statements . bind (
3983+ self ,
39703984 start_char ,
39713985 start_char - line_counts [ predicate . location . end_line - 1 ] . start ,
39723986 ending . location . start_char ,
@@ -3988,7 +4002,7 @@ def on_while_mod(predicate, statement)
39884002 WhileNode . new (
39894003 predicate : predicate ,
39904004 statements :
3991- Statements . new ( self , body : [ statement ] , location : statement . location ) ,
4005+ Statements . new ( body : [ statement ] , location : statement . location ) ,
39924006 location : statement . location . to ( predicate . location )
39934007 )
39944008 end
0 commit comments