UString Debugger::varInfo(const UString &ident) { if (!eng) return UString(); const List *chain = Context::current()->pScopeChain(); ListIterator scope = chain->begin(); while (scope != chain->end()) { if (scope->hasProperty(ident)) { KJSO val = scope->get(ident); return UString(val.imp()->typeInfo()->name) + ":" + val.toString().value(); } scope++; } return UString(); }
bool Debugger::setVar(const UString &ident, const KJSO &value) { if (!eng) return false; const List *chain = Context::current()->pScopeChain(); ListIterator scope = chain->begin(); while (scope != chain->end()) { if (scope->hasProperty(ident)) { if (!scope->canPut(ident)) return false; scope->put(ident, value); return true; } scope++; } // didn't find variable return false; }