diff options
author | Kent Hansen <khansen@trolltech.com> | 2009-08-14 12:05:25 (GMT) |
---|---|---|
committer | Kent Hansen <khansen@trolltech.com> | 2009-08-14 12:05:25 (GMT) |
commit | e0a86dc604b87921652b844a5f85889bb6291ed9 (patch) | |
tree | edc084c4e047dfc1724d76adc8bb65ae9ca0be19 /src/script/bridge/qscriptactivationobject_p.h | |
parent | 61c303e8bab04312c17ad2ee03e9ba3f29a0184b (diff) | |
download | Qt-e0a86dc604b87921652b844a5f85889bb6291ed9.zip Qt-e0a86dc604b87921652b844a5f85889bb6291ed9.tar.gz Qt-e0a86dc604b87921652b844a5f85889bb6291ed9.tar.bz2 |
make it possible for any script object to serve as activation object
This was possible in the old back-end. In JSC, activation objects
have to be instances of JSC::JSVariableObject. So the way we solve
it is by having our QScriptActivationObject be able to act as a
proxy to any other JSObject.
Diffstat (limited to 'src/script/bridge/qscriptactivationobject_p.h')
-rw-r--r-- | src/script/bridge/qscriptactivationobject_p.h | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/src/script/bridge/qscriptactivationobject_p.h b/src/script/bridge/qscriptactivationobject_p.h index 8c62b23..fd7b0be 100644 --- a/src/script/bridge/qscriptactivationobject_p.h +++ b/src/script/bridge/qscriptactivationobject_p.h @@ -64,21 +64,37 @@ namespace QScript class QScriptActivationObject : public JSC::JSVariableObject { public: - QScriptActivationObject(JSC::ExecState *callFrame); + QScriptActivationObject(JSC::ExecState *callFrame, JSC::JSObject *delegate = 0); virtual ~QScriptActivationObject(); virtual bool isDynamicScope() const { return true; } + + virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertySlot&); + virtual bool getPropertyAttributes(JSC::ExecState*, const JSC::Identifier&, unsigned&) const; + virtual void getPropertyNames(JSC::ExecState*, JSC::PropertyNameArray&, unsigned listedAttributes = JSC::Structure::Prototype); + virtual void putWithAttributes(JSC::ExecState *exec, const JSC::Identifier &propertyName, JSC::JSValue value, unsigned attributes); + virtual void put(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::JSValue value, JSC::PutPropertySlot&); + virtual void put(JSC::ExecState*, unsigned propertyName, JSC::JSValue value); + + virtual bool deleteProperty(JSC::ExecState*, const JSC::Identifier& propertyName, bool checkDontDelete = true); virtual const JSC::ClassInfo* classInfo() const { return &info; } static const JSC::ClassInfo info; struct QScriptActivationObjectData : public JSVariableObjectData { - QScriptActivationObjectData(JSC::Register* registers) - : JSVariableObjectData(&symbolTable, registers) + QScriptActivationObjectData(JSC::Register* registers, JSC::JSObject *dlg) + : JSVariableObjectData(&symbolTable, registers), + delegate(dlg) { } JSC::SymbolTable symbolTable; + JSC::JSObject *delegate; }; + JSC::JSObject *delegate() const + { return d_ptr()->delegate; } + void setDelegate(JSC::JSObject *delegate) + { d_ptr()->delegate = delegate; } + QScriptActivationObjectData *d_ptr() const { return static_cast<QScriptActivationObjectData *>(d); } }; |