From 19a310b0ac6bfc78340d37963ea2655783760bee Mon Sep 17 00:00:00 2001 From: aycabta Date: Wed, 20 Nov 2019 09:56:13 +0900 Subject: [PATCH] A preceding token of "do" of block has EXPR_CMDARG or EXPR_ENDFN meth do # the preceding token of "do" has EXPR_CMDARG end meth() do # the preceding token of "do" has EXPR_ENDFN end --- lib/irb/ruby-lex.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/irb/ruby-lex.rb b/lib/irb/ruby-lex.rb index 81024ea5bd..586123fa38 100644 --- a/lib/irb/ruby-lex.rb +++ b/lib/irb/ruby-lex.rb @@ -306,7 +306,7 @@ class RubyLex next if index > 0 and @tokens[index - 1][3].allbits?(Ripper::EXPR_FNAME) case t[2] when 'do' - if index > 0 and @tokens[index - 1][3].allbits?(Ripper::EXPR_CMDARG) + if index > 0 and @tokens[index - 1][3].anybits?(Ripper::EXPR_CMDARG | Ripper::EXPR_ENDFN) # method_with_bock do; end indent += 1 else @@ -349,7 +349,7 @@ class RubyLex next if index > 0 and @tokens[index - 1][3].allbits?(Ripper::EXPR_FNAME) case t[2] when 'do' - if index > 0 and @tokens[index - 1][3].allbits?(Ripper::EXPR_CMDARG) + if index > 0 and @tokens[index - 1][3].anybits?(Ripper::EXPR_CMDARG | Ripper::EXPR_ENDFN) # method_with_bock do; end depth_difference += 1 else