pharo icon indicating copy to clipboard operation
pharo copied to clipboard

[RB] RBClass has confusing interfaces

Open Ducasse opened this issue 2 years ago • 15 comments

existingMethodsThatReferToInstanceVariable:

returns selectors

whichMethodsReferToInstanceVariable:

returns selectors

So we should introduce existingSelectorsThatReferToInstanceVariable and whichSelectorsReferToInstanceVariable or a least make sure that existingMethodsThatReferToInstanceVariable and whichMethodsReferToInstanceVariable return methods!

Ducasse avatar Sep 26 '23 19:09 Ducasse

I've checked this and they don't return selectors anymore. In the new system existingMethodsThatReferToInstanceVariable: returns CompiledMethod but whichMethodsReferToInstanceVariable: is tricky because it returns both CompiledMethods (since it uses the method from above). But it also return RBMethod for every new method that is added. This might be OK if API is polymorphic between CompiledMethod and RBMethod, but I didn't check that. Maybe we can close this and open a new issue for this if it is needed in the first place.

Code to reproduce:

ns := RBNamespace new.
cls := ns classNamed: 'RBClass'.
cls compile: 'asdf1234 ^ tagName' classified: 'to remove'.
cls existingMethodsThatReferToInstanceVariable: #'tagName'.
cls whichMethodsReferToInstanceVariable: #'tagName'.

Image

balsa-sarenac avatar Feb 27 '24 10:02 balsa-sarenac