Skip to content

Commit 63c5cb5

Browse files
authored
Merge pull request #891 from nobu/initvm
Parse also InitVM-prefixed functions
2 parents 6d7bf24 + 030d10f commit 63c5cb5

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

lib/rdoc/parser/c.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -720,7 +720,7 @@ def find_class_comment class_name, class_mod
720720
((?>/\*.*?\*/\s+))
721721
(static\s+)?
722722
void\s+
723-
Init_#{class_name}\s*(?:_\(\s*)?\(\s*(?:void\s*)?\)%xmi then
723+
Init(?:VM)?_(?i:#{class_name})\s*(?:_\(\s*)?\(\s*(?:void\s*)?\)%xm then
724724
comment = $1.sub(%r%Document-(?:class|module):\s+#{class_name}%, '')
725725
elsif @content =~ %r%Document-(?:class|module):\s+#{class_name}\s*?
726726
(?:<\s+[:,\w]+)?\n((?>.*?\*/))%xm then

test/rdoc/test_rdoc_parser_c.rb

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -857,6 +857,23 @@ def test_find_class_comment_init
857857
assert_equal "a comment for class Foo", klass.comment.text
858858
end
859859

860+
861+
def test_find_class_comment_initvm
862+
content = <<-EOF
863+
/*
864+
* a comment for class Foo
865+
*/
866+
void
867+
InitVM_Foo(void) {
868+
VALUE foo = rb_define_class("Foo", rb_cObject);
869+
}
870+
EOF
871+
872+
klass = util_get_class content, 'foo'
873+
874+
assert_equal "a comment for class Foo", klass.comment.text
875+
end
876+
860877
def test_find_class_comment_define_class
861878
content = <<-EOF
862879
/*

0 commit comments

Comments
 (0)