// on our SimpleScriptable we need to avoid looking at the properties we have defined => TODO: improve it
if (thisObj instanceof SimpleScriptable) {
return "[anonymous]";
}
Scriptable obj = thisObj;
while (obj != null) {
for (final Object id : obj.getIds()) {
if (id instanceof String) {
final String s = (String) id;
if (obj instanceof ScriptableObject) {
Object o = ((ScriptableObject) obj).getGetterOrSetter(s, 0, false);
if (o == null) {
o = ((ScriptableObject) obj).getGetterOrSetter(s, 0, true);
if (o != null && o instanceof Callable) {
return "__defineSetter__ " + s;
}
}
else if (o instanceof Callable) {
return "__defineGetter__ " + s;
}
}
final Object o = obj.get(s, obj);
if (o instanceof NativeFunction) {
final NativeFunction f = (NativeFunction) o;
if (f.getDebuggableView() == this.functionOrScript_) {
return s;
}
}
}
}
obj = obj.getPrototype();
}
// Unable to intuit a name -- doh!
return "[anonymous]";
}
// Just a script -- no function name.