Description
When module_function
is invoked, the given method becomes available in the singleton class and it is turned into a private method on including namespaces. For example:
module A
def foo; end
module_function :foo
end
A.foo # okay!
class Something
include A
end
Something.new.foo # not okay, instance method foo is private
We need to add processing for module_function
here. Essentially, when we find an invocation to module_function
, we want to:
- Get the method entry that was already inserted in the index. Update the visibility to private
- Add a new method entry for the same method, but in this case the owner is the singleton class