Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get the compiled method the is being executed

How to get an instance of CompiledMethod that is currently being executed?

i.e.

someMethod
  | thisMethod |
  thisMethod := "here I want to access an instance of _CompiledMethod_ that refers to #someMethod".
  ^ thisMethod selector
like image 259
Uko Avatar asked Dec 09 '25 07:12

Uko


1 Answers

Method that is currently being executed can be retrieved by #method message from current context, which can be accessed through thisContext pseudo variable.

This way example code will look like this:

someMethod
  | thisMethod |
  thisMethod := thisContext method.
  ^ thisMethod selector
like image 158
Uko Avatar answered Dec 12 '25 18:12

Uko



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!