Skip to content

Commit 4ce7ba4

Browse files
committed
Fix postfix :nodoc:
In parse_statements, when TkEND === tk and nest == 0, checks postfix :nodoc: for class even where inside methods. So if a method has postfix :nodoc:, it raises strange behavior. This commit fixes it.
1 parent 1261ff6 commit 4ce7ba4

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

lib/rdoc/parser/ruby.rb

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -752,6 +752,9 @@ def parse_class container, single, tk, comment
752752

753753
cls.line = line_no
754754

755+
# after end modifiers
756+
read_documentation_modifiers cls, RDoc::CLASS_MODIFIERS
757+
755758
cls
756759
end
757760

@@ -1311,6 +1314,9 @@ def parse_method(container, single, tk, comment)
13111314

13121315
meth.comment = comment
13131316

1317+
# after end modifiers
1318+
read_documentation_modifiers meth, RDoc::METHOD_MODIFIERS
1319+
13141320
@stats.add_method meth
13151321
end
13161322

@@ -1542,6 +1548,9 @@ def parse_module container, single, tk, comment
15421548
mod.add_comment comment, @top_level
15431549
parse_statements mod
15441550

1551+
# after end modifiers
1552+
read_documentation_modifiers mod, RDoc::CLASS_MODIFIERS
1553+
15451554
@stats.add_module mod
15461555
end
15471556

@@ -1715,7 +1724,6 @@ def parse_statements(container, single = NORMAL, current_method = nil,
17151724
when TkEND then
17161725
nest -= 1
17171726
if nest == 0 then
1718-
read_documentation_modifiers container, RDoc::CLASS_MODIFIERS
17191727
container.ongoing_visibility = save_visibility
17201728

17211729
parse_comment container, tk, comment unless comment.empty?

0 commit comments

Comments
 (0)