Skip to content

Commit ba7bf36

Browse files
committed
Also support @alias #membername.
1 parent ec3478b commit ba7bf36

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

lib/jsduck/doc_parser.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ def parse_loop
124124
at_member
125125
elsif look(/@inherit[dD]oc\b/)
126126
at_inheritdoc
127-
elsif look(/@alias\s+[\w.]+#\w+/)
127+
elsif look(/@alias\s+([\w.]+)?#\w+/)
128128
# For backwards compatibility.
129129
# @alias tag was used as @inheritdoc before
130130
at_inheritdoc

spec/aggregator_inheritdoc_spec.rb

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ def parse_simple_source(at_tag)
344344
end
345345
end
346346

347-
describe "@inheritdoc with member name parameter" do
347+
shared_examples_for "with member name parameter" do
348348
before do
349349
@docs = parse(<<-EOF)
350350
/**
@@ -356,7 +356,7 @@ def parse_simple_source(at_tag)
356356
*/
357357
/**
358358
* @method foobar
359-
* @inheritdoc #bar
359+
* #{@tagname} #bar
360360
* New comment.
361361
*/
362362
EOF
@@ -368,6 +368,20 @@ def parse_simple_source(at_tag)
368368
end
369369
end
370370

371+
describe "@inheritdoc" do
372+
before do
373+
@tagname = "@inheritdoc"
374+
end
375+
it_behaves_like "with member name parameter"
376+
end
377+
378+
describe "@alias" do
379+
before do
380+
@tagname = "@alias"
381+
end
382+
it_behaves_like "with member name parameter"
383+
end
384+
371385
describe "@inheritdoc without parameter" do
372386
before do
373387
@docs = parse(<<-EOF)

0 commit comments

Comments
 (0)