Skip to content

Commit

Permalink
Merge pull request #753 from aycabta/treat-proc-call-correctly
Browse files Browse the repository at this point in the history
Treat Proc#call syntax sugar for constant correctly
  • Loading branch information
aycabta authored Dec 23, 2019
2 parents e507a7d + 957d041 commit b7af12d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/rdoc/parser/ruby.rb
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,10 @@ def get_class_or_module container, ignore_constants = false

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}"
Expand Down
11 changes: 11 additions & 0 deletions test/rdoc/test_rdoc_parser_ruby.rb
Original file line number Diff line number Diff line change
Expand Up @@ -830,6 +830,17 @@ class Foo
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
Expand Down

0 comments on commit b7af12d

Please sign in to comment.