December 3, 2004, 12:00 am
/*
this will find all usages/references/mentions of a method anywhere in any class.
it searches through each method's literals for the method name stored as a symbol.
just found a bug. update posted soon.
this doesn't check { } func defs inside methods (or recursively scan fund defs)
doesn't check class methods either.
*/
Library.put([\Tests,\referencesToMethod],{
GetStringDialog("Method name:","",{
arg ok,string;
var fn;
fn = { arg methodName;
var found;
found = Array(8);
Class.allClasses.do({ arg class;
(class.methods ?? {[]}).do({ arg method;
var literals;
literals = method.literals;
if(literals.notNil,{
literals.do({ arg lit;
if(lit === methodName ,{
found = found.add(method);
})
})
});
})
});
found
};
if(ok,{
this.newErrorWindow;
fn.value(string.asSymbol).do({ arg method;
method.postln;
});
})
});
});
Rgds!