summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKent Hansen <khansen@trolltech.com>2009-08-10 09:03:51 (GMT)
committerKent Hansen <khansen@trolltech.com>2009-08-10 09:03:51 (GMT)
commita5cc9714deb37281d97f03f3eaf23ebd0be41f0f (patch)
treef2113d046414e2ee165eff0990287ab42a3c526c
parente5913012f44843bd8f7a6cc28de5de87f134aa65 (diff)
downloadQt-a5cc9714deb37281d97f03f3eaf23ebd0be41f0f.zip
Qt-a5cc9714deb37281d97f03f3eaf23ebd0be41f0f.tar.gz
Qt-a5cc9714deb37281d97f03f3eaf23ebd0be41f0f.tar.bz2
make ResolveScope property lookup work (kind of)
Look in the __qt_scope__ property that is set by QScriptValue::setScope().
-rw-r--r--src/script/api/qscriptvalue.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/script/api/qscriptvalue.cpp b/src/script/api/qscriptvalue.cpp
index b24c67a..d2569ae 100644
--- a/src/script/api/qscriptvalue.cpp
+++ b/src/script/api/qscriptvalue.cpp
@@ -371,9 +371,16 @@ QScriptValue QScriptValuePrivate::property(const JSC::Identifier &id, int resolv
JSC::JSValue result;
if (const_cast<JSC::JSObject*>(object)->getOwnPropertySlot(exec, id, slot)) {
result = slot.getValue(exec, id);
- } else if ((resolveMode & QScriptValue::ResolvePrototype)
+ } else {
+ if ((resolveMode & QScriptValue::ResolvePrototype)
&& const_cast<JSC::JSObject*>(object)->getPropertySlot(exec, id, slot)) {
- result = slot.getValue(exec, id);
+ result = slot.getValue(exec, id);
+ } else if (resolveMode & QScriptValue::ResolveScope) {
+ // ### check if it's a function object and look in the scope chain
+ QScriptValue scope = property(QString::fromLatin1("__qt_scope__"), QScriptValue::ResolveLocal);
+ if (scope.isObject())
+ result = eng_p->scriptValueToJSCValue(QScriptValuePrivate::get(scope)->property(id, resolveMode));
+ }
}
return eng_p->scriptValueFromJSCValue(result);
}