Skip to content

Commit 26fd1a7

Browse files
committed
Change variables handling for compatibility
1 parent bcd9683 commit 26fd1a7

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

lib/irb/ruby-lex.rb

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -201,14 +201,14 @@ def lex
201201
code = @line + (line.nil? ? '' : line)
202202
code.gsub!(/\s*\z/, '').concat("\n")
203203
@tokens = ripper_lex_without_warning(code)
204-
@continue = process_continue(@tokens)
205-
@code_block_open = check_code_block(code, @tokens)
206-
@indent = process_nesting_level(@tokens)
207-
@ltype = process_literal_type(@tokens)
204+
@continue = process_continue
205+
@code_block_open = check_code_block(code)
206+
@indent = process_nesting_level
207+
@ltype = process_literal_type
208208
line
209209
end
210210

211-
def process_continue(tokens)
211+
def process_continue(tokens = @tokens)
212212
# last token is always newline
213213
if tokens.size >= 2 and tokens[-2][1] == :on_regexp_end
214214
# end of regexp literal
@@ -228,7 +228,7 @@ def process_continue(tokens)
228228
false
229229
end
230230

231-
def check_code_block(code, tokens)
231+
def check_code_block(code, tokens = @tokens)
232232
return true if tokens.empty?
233233
if tokens.last[1] == :on_heredoc_beg
234234
return true
@@ -321,7 +321,7 @@ def check_code_block(code, tokens)
321321
false
322322
end
323323

324-
def process_nesting_level(tokens)
324+
def process_nesting_level(tokens = @tokens)
325325
indent = 0
326326
in_oneliner_def = nil
327327
tokens.each_with_index { |t, index|
@@ -574,7 +574,7 @@ def check_string_literal(tokens)
574574
start_token.last.nil? ? '' : start_token.last
575575
end
576576

577-
def process_literal_type(tokens)
577+
def process_literal_type(tokens = @tokens)
578578
start_token = check_string_literal(tokens)
579579
case start_token[1]
580580
when :on_tstring_beg

0 commit comments

Comments
 (0)