QScriptDeclarativeClass::Value QScriptDeclarativeClass::newObjectValue(QScriptEngine *engine,QScriptDeclarativeClass *scriptClass, Object *object) { Q_ASSERT(engine); Q_ASSERT(scriptClass); QScriptEnginePrivate *p = QScriptEnginePrivate::cs_getPrivate(engine); QScript::APIShim shim(p); JSC::ExecState* exec = p->currentFrame; QScriptObject *result = new (exec) QScriptObject(p->scriptObjectStructure); result->setDelegate(new QScript::DeclarativeObjectDelegate(scriptClass, object)); return jscToValue(JSC::JSValue(result)); }
QScriptDeclarativeClass::Value QScriptDeclarativeClass::propertyValue(const QScriptValue &v, const Identifier &name) { QScriptValuePrivate *d = QScriptValuePrivate::get(v); if (!d->isObject()) return Value(); QScript::APIShim shim(d->engine); JSC::ExecState *exec = d->engine->currentFrame; JSC::JSObject *object = d->jscValue.getObject(); JSC::PropertySlot slot(const_cast<JSC::JSObject*>(object)); JSC::JSValue result; JSC::Identifier id(exec, (JSC::UString::Rep *)name); if (const_cast<JSC::JSObject*>(object)->getOwnPropertySlot(exec, id, slot)) { result = slot.getValue(exec, id); return jscToValue(result); } return Value(); }