Skip to content

Commit b7af12d

Browse files
authored
Merge pull request #753 from aycabta/treat-proc-call-correctly
Treat Proc#call syntax sugar for constant correctly
2 parents e507a7d + 957d041 commit b7af12d

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

lib/rdoc/parser/ruby.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,10 @@ def get_class_or_module container, ignore_constants = false
379379

380380
get_tk
381381
skip_tkspace_without_nl
382+
if :on_lparen == peek_tk[:kind] # ProcObjectInConstant::()
383+
parse_method_or_yield_parameters
384+
break
385+
end
382386
name_t = get_tk
383387
unless :on_const == name_t[:kind] || :on_ident == name_t[:kind]
384388
raise RDoc::Error, "Invalid class or module definition: #{given_name}"

test/rdoc/test_rdoc_parser_ruby.rb

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -830,6 +830,17 @@ class Foo
830830
assert_equal @top_level, blah.file
831831
end
832832

833+
def test_parse_call_syntax_sugar_for_constant
834+
util_parser <<-CODE
835+
Foo = proc{}
836+
Foo::()
837+
CODE
838+
839+
assert_nothing_raised do
840+
@parser.scan
841+
end
842+
end
843+
833844
def test_parse_class_multi_ghost_methods
834845
util_parser <<-'CLASS'
835846
class Foo

0 commit comments

Comments
 (0)