Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
No more wrapper #4102
See the commits for the longer story, but basically WrapperMethod does not pass through the "new" impl class to the contained method, which results in it supering up the wrong hierarchy.
I have a few concerns, which is why I opened a PR for review:
This is part of fixes for #3869. Duping methods by reconstructing them causes them to have a new serial number, which is what we are using to determine method equality (and not much else). By changing dup to use clone here, Ruby methods transplanted from a module to the same module will still be == and eql?.
This is for #3869 and relates to the module_function change from and redefine it with a new visibility and implementation class. However the impl class never passed through to the contained method, preventing it from being used in super. This affected, for example, module_fuction singleton methods that need to super or methods transplanted using defined_method with a Method instance. The new logic always tries to dup the target method so it can be truly populated with the altered fields. This change fixed The previous commit, using cloning instead of construction for IR methods, works around the fact that there's no semi-transparent WrapperMethod to delegate its serial number to the wrapped method. Since in that case and in this one, the method's serial number was expected to be the same after duplication, the clone technique seems acceptable.