[前][次][番号順一覧][スレッド一覧]

ruby-changes:58850

From: aycabta <ko1@a...>
Date: Wed, 20 Nov 2019 10:00:45 +0900 (JST)
Subject: [ruby-changes:58850] 19a310b0ac (master): A preceding token of "do" of block has EXPR_CMDARG or EXPR_ENDFN

https://git.ruby-lang.org/ruby.git/commit/?id=19a310b0ac

From 19a310b0ac6bfc78340d37963ea2655783760bee Mon Sep 17 00:00:00 2001
From: aycabta <aycabta@g...>
Date: Wed, 20 Nov 2019 09:56:13 +0900
Subject: 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

diff --git a/lib/irb/ruby-lex.rb b/lib/irb/ruby-lex.rb
index 81024ea..586123f 100644
--- a/lib/irb/ruby-lex.rb
+++ b/lib/irb/ruby-lex.rb
@@ -306,7 +306,7 @@ class RubyLex https://github.com/ruby/ruby/blob/trunk/lib/irb/ruby-lex.rb#L306
         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 https://github.com/ruby/ruby/blob/trunk/lib/irb/ruby-lex.rb#L349
         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
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]