debugging - Squeak: getting the source code of a method in run-time -
i'm writing small program modifies method during run-time in squeak. saw in squeak there method called getsource (defined in compiledmethod class), returns source code of compiled method.
how source code of method if input symbol corresponding method?
you should know class in method defined, can access compiledmethod via, eg,
theclass >> methodselectorsymbol or
theclass compiledmethodat: methodselectorsymbol with theclass being class method , methodselectorsymbol symbol corresponds method, ie, input. there further approaches, too. example,
theclass lookupselector: methodselectorsymbol not searches in theclass in superclasses.
however, approaches require give class starting point.
Comments
Post a Comment