rdoc/parser/c.rb: ignore dynamically added methods

* lib/rdoc/parser/c.rb (RDoc::Parser::C#deduplicate_call_seq):
  skip dynamically added methods at runtime, because the class
  name is unknown and the defined methods are not accessible from
  that class.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65403 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2018-10-28 01:56:28 +00:00
parent 091c04df53
commit 8586f021f8
2 changed files with 14 additions and 0 deletions

View File

@ -217,6 +217,7 @@ class RDoc::Parser::C < RDoc::Parser
def deduplicate_call_seq
@methods.each do |var_name, functions|
class_name = @known_classes[var_name]
next unless class_name
class_obj = find_class var_name, class_name
functions.each_value do |method_names|

View File

@ -1630,6 +1630,19 @@ Init_IO(void) {
assert read_method.singleton
end
def test_define_method_dynamically
content = <<-EOF
void
Init_foo(void)
{
rb_define_singleton_method(obj, "foo", foo, -1);
}
EOF
klass = util_get_class content, 'obj'
assert_nil klass
end
def test_define_method_with_prototype
content = <<-EOF
static VALUE rb_io_s_read(int, VALUE*, VALUE);