Skip to content

Commit

Permalink
Parse ary and new_ary types in call-seq
Browse files Browse the repository at this point in the history
  • Loading branch information
ypresto committed Jul 19, 2017
1 parent 3374f8c commit a4af5e1
Show file tree
Hide file tree
Showing 3 changed files with 3,532 additions and 1,142 deletions.
2 changes: 1 addition & 1 deletion lib/yard/parser/c/comment_parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def parse_types(types)
case t.strip.gsub(/^an?_/, '')
when "class"; "Class"
when "obj", "object", "anObject"; "Object"
when "arr", "array", "anArray", /^\[/; "Array"
when "arr", "array", "anArray", "ary", "new_ary", /^\[/; "Array"
when /^char\s*\*/, "char", "str", "string", "new_str"; "String"
when "enum", "anEnumerator"; "Enumerator"
when "exc", "exception"; "Exception"
Expand Down
10 changes: 10 additions & 0 deletions spec/parser/c_parser_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,16 @@ def parse(contents)
expect(obj.docstring).not_to be_blank
expect(obj.tags(:overload).size).to be > 1
end

it "parses new_ary return type" do
obj = YARD::Registry.at('Array#map')
expect(obj.tags(:overload).count do |overload|
overload.tag(:return) && overload.tag(:return).types == ['Enumerator']
end).to eq 2
expect(obj.tags(:overload).count do |overload|
overload.tag(:return) && overload.tag(:return).types == ['Array']
end).to eq 2
end
end

describe "C++ namespace" do
Expand Down
Loading

0 comments on commit a4af5e1

Please sign in to comment.