2014-08-07 5:11 GMT+02:00 aria2end <aria2end@gmail.com>:
Hi, I know that I can see senders and implementers of a method but is there any way to see all methods that are used in a method ?
This is impossible. The method called for each message send can only been known at runtime, because it depends on the receiver class. The only thing you could see is the list of selectors (name of methods) called from this method. This is possible by sending #messages to the compiledMethod. Example: you have a method named #foo:bar: implemented in MyClass: MyClass>>foo: arg1 bar: arg2 ^ self baz: arg1 + arg2 You can open a workspace, and run: (MyClass >>#foo:bar:) messages which answers: a Set(#baz: #+) but you cannot see the methods called, because depending on the class of arg1, the method called for #+ may be any of these methods: AJMem>>#+ Collection>>#+ Color>>#+ DateAndTime>>#+ Duration>>#+ Float>>#+ FloatArray>>#+ Fraction>>#+ Integer>>#+ Interval>>#+ KMComposedModifier>>#+ KMKeyCombinationSequence>>#+ KMModifier>>#+ KMNoShortcut>>#+ LargeInteger>>#+ Number>>#+ Point>>#+ ROAbstractComponent>>#+ ROShape>>#+ ROShape class>>#+ ScaledDecimal>>#+ SmallInteger>>#+ String>>#+ Timespan>>#+ TraitComposition>>#+ TraitDescription>>#+ TraitTransformation>>#+ WordArray>>#+ TComposingDescription>>#+ Or perhaps you want to see all the potential methods called. Then you can open a workspace and run this script: | methods mb | methods := ((CompiledMethod>>#foo:bar:) messages collect: [ :selector | selector implementors ]) flattened. mb := MethodBrowser new. mb openWithSpec. mb methods: methods
or any way to see all the send messages to other methods limited to scope of a method ?
all the send messages to other methods ? Well for that you'll need type inference to find out which variables are actually methods, and then see what messages are sent to those variables. But why would one want to do that ?
Thanks, Aria
-- View this message in context: http://forum.world.st/Seeing-all-the-methods-that-is-used-in-a-method-tp4772... Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.