summaryrefslogtreecommitdiff
path: root/lib/irb
diff options
context:
space:
mode:
authormanga_osyo <manga.osyo@gmail.com>2021-12-06 10:04:12 +0900
committeraycabta <aycabta@gmail.com>2021-12-24 20:44:02 +0900
commitf279d41847e07949ca7ad3f2d3d5cbe9fa3aabf5 (patch)
tree3d6be903195141ab14ff30f56fcf558a787f2709 /lib/irb
parentbabc200ee89e9f7329d167b2f725a51486a7f6aa (diff)
Fix warning in `Lexer::Elem#[]`
Changed to use `#pos` `#event` `#tok` `#state` since using Lexer::Elem#[0~4] now gives a warning. see: https://github.com/ruby/ruby/commit/8944009be7418614ce7d4077807ac2b60d4d5d85 https://github.com/ruby/reline/commit/9adbb9af32
Diffstat (limited to 'lib/irb')
-rw-r--r--lib/irb/ruby-lex.rb8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/irb/ruby-lex.rb b/lib/irb/ruby-lex.rb
index f2069a2b5f..29862f5507 100644
--- a/lib/irb/ruby-lex.rb
+++ b/lib/irb/ruby-lex.rb
@@ -752,16 +752,16 @@ class RubyLex
end
i += 1
end
- start_token.last.nil? ? '' : start_token.last
+ start_token.last.nil? ? nil : start_token.last
end
def process_literal_type(tokens = @tokens)
start_token = check_string_literal(tokens)
return nil if start_token == ""
- case start_token.event
+ case start_token&.event
when :on_tstring_beg
- case start_token.tok
+ case start_token&.tok
when ?" then ?"
when /^%.$/ then ?"
when /^%Q.$/ then ?"
@@ -776,7 +776,7 @@ class RubyLex
when :on_qsymbols_beg then ?]
when :on_symbols_beg then ?]
when :on_heredoc_beg
- start_token.tok =~ /<<[-~]?(['"`])[_a-zA-Z0-9]+\1/
+ start_token&.tok =~ /<<[-~]?(['"`])[_a-zA-Z0-9]+\1/
case $1
when ?" then ?"
when ?' then ?'