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

ruby-changes:59427

From: aycabta <ko1@a...>
Date: Tue, 24 Dec 2019 09:18:12 +0900 (JST)
Subject: [ruby-changes:59427] e50e552693 (master): [ruby/rdoc] Treat Proc#call syntax sugar for constant correctly

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

From e50e55269358520dc55595a9c3e074d351d96b66 Mon Sep 17 00:00:00 2001
From: aycabta <aycabta@g...>
Date: Tue, 24 Dec 2019 07:00:35 +0900
Subject: [ruby/rdoc] Treat Proc#call syntax sugar for constant correctly

https://github.com/ruby/rdoc/commit/957d041ae0

diff --git a/lib/rdoc/parser/ruby.rb b/lib/rdoc/parser/ruby.rb
index c87765b..dffe304 100644
--- a/lib/rdoc/parser/ruby.rb
+++ b/lib/rdoc/parser/ruby.rb
@@ -379,6 +379,10 @@ class RDoc::Parser::Ruby < RDoc::Parser https://github.com/ruby/ruby/blob/trunk/lib/rdoc/parser/ruby.rb#L379
 
       get_tk
       skip_tkspace_without_nl
+      if :on_lparen == peek_tk[:kind] # ProcObjectInConstant::()
+        parse_method_or_yield_parameters
+        break
+      end
       name_t = get_tk
       unless :on_const == name_t[:kind] || :on_ident == name_t[:kind]
         raise RDoc::Error, "Invalid class or module definition: #{given_name}"
diff --git a/test/rdoc/test_rdoc_parser_ruby.rb b/test/rdoc/test_rdoc_parser_ruby.rb
index 99f4de2..8673225 100644
--- a/test/rdoc/test_rdoc_parser_ruby.rb
+++ b/test/rdoc/test_rdoc_parser_ruby.rb
@@ -830,6 +830,17 @@ end https://github.com/ruby/ruby/blob/trunk/test/rdoc/test_rdoc_parser_ruby.rb#L830
     assert_equal @top_level, blah.file
   end
 
+  def test_parse_call_syntax_sugar_for_constant
+    util_parser <<-CODE
+Foo = proc{}
+Foo::()
+    CODE
+
+    assert_nothing_raised do
+      @parser.scan
+    end
+  end
+
   def test_parse_class_multi_ghost_methods
     util_parser <<-'CLASS'
 class Foo
-- 
cgit v0.10.2


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

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