summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authoraycabta <aycabta@gmail.com>2020-12-22 04:49:02 +0900
committeraycabta <aycabta@gmail.com>2020-12-22 23:45:43 +0900
commit47b26795d06ea13d646edddd51470d9a6cd377b4 (patch)
tree5186f038e38764068b3cdd2283d197aad521a96f /lib
parentcae8bbfe6271a15cf212a83a9c3ac3fedcdc7718 (diff)
[ruby/irb] Change variables handling for compatibility
https://github.com/ruby/irb/commit/26fd1a75cf
Diffstat (limited to 'lib')
-rw-r--r--lib/irb/ruby-lex.rb16
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/irb/ruby-lex.rb b/lib/irb/ruby-lex.rb
index 040c93e8f7..71145224ad 100644
--- a/lib/irb/ruby-lex.rb
+++ b/lib/irb/ruby-lex.rb
@@ -201,14 +201,14 @@ class RubyLex
code = @line + (line.nil? ? '' : line)
code.gsub!(/\s*\z/, '').concat("\n")
@tokens = ripper_lex_without_warning(code)
- @continue = process_continue(@tokens)
- @code_block_open = check_code_block(code, @tokens)
- @indent = process_nesting_level(@tokens)
- @ltype = process_literal_type(@tokens)
+ @continue = process_continue
+ @code_block_open = check_code_block(code)
+ @indent = process_nesting_level
+ @ltype = process_literal_type
line
end
- def process_continue(tokens)
+ def process_continue(tokens = @tokens)
# last token is always newline
if tokens.size >= 2 and tokens[-2][1] == :on_regexp_end
# end of regexp literal
@@ -228,7 +228,7 @@ class RubyLex
false
end
- def check_code_block(code, tokens)
+ def check_code_block(code, tokens = @tokens)
return true if tokens.empty?
if tokens.last[1] == :on_heredoc_beg
return true
@@ -321,7 +321,7 @@ class RubyLex
false
end
- def process_nesting_level(tokens)
+ def process_nesting_level(tokens = @tokens)
indent = 0
in_oneliner_def = nil
tokens.each_with_index { |t, index|
@@ -574,7 +574,7 @@ class RubyLex
start_token.last.nil? ? '' : start_token.last
end
- def process_literal_type(tokens)
+ def process_literal_type(tokens = @tokens)
start_token = check_string_literal(tokens)
case start_token[1]
when :on_tstring_beg