summaryrefslogtreecommitdiffstats
path: root/src/script/bridge
diff options
context:
space:
mode:
Diffstat (limited to 'src/script/bridge')
-rw-r--r--src/script/bridge/qscriptactivationobject.cpp58
-rw-r--r--src/script/bridge/qscriptactivationobject_p.h22
2 files changed, 75 insertions, 5 deletions
diff --git a/src/script/bridge/qscriptactivationobject.cpp b/src/script/bridge/qscriptactivationobject.cpp
index ae466e8..5faf7fe 100644
--- a/src/script/bridge/qscriptactivationobject.cpp
+++ b/src/script/bridge/qscriptactivationobject.cpp
@@ -63,8 +63,9 @@ namespace QScript
const JSC::ClassInfo QScriptActivationObject::info = { "QScriptActivationObject", 0, 0, 0 };
-QScriptActivationObject::QScriptActivationObject(JSC::ExecState *callFrame)
- : JSC::JSVariableObject(callFrame->globalData().activationStructure, new QScriptActivationObjectData(callFrame->registers()))
+QScriptActivationObject::QScriptActivationObject(JSC::ExecState *callFrame, JSC::JSObject *delegate)
+ : JSC::JSVariableObject(callFrame->globalData().activationStructure,
+ new QScriptActivationObjectData(callFrame->registers(), delegate))
{
}
@@ -73,8 +74,36 @@ QScriptActivationObject::~QScriptActivationObject()
delete d;
}
+bool QScriptActivationObject::getOwnPropertySlot(JSC::ExecState* exec, const JSC::Identifier& propertyName, JSC::PropertySlot& slot)
+{
+ if (d_ptr()->delegate != 0)
+ return d_ptr()->delegate->getOwnPropertySlot(exec, propertyName, slot);
+ return JSC::JSVariableObject::getOwnPropertySlot(exec, propertyName, slot);
+}
+
+bool QScriptActivationObject::getPropertyAttributes(JSC::ExecState* exec, const JSC::Identifier& propertyName, unsigned& attributes) const
+{
+ if (d_ptr()->delegate != 0)
+ return d_ptr()->delegate->getPropertyAttributes(exec, propertyName, attributes);
+ return JSC::JSVariableObject::getPropertyAttributes(exec, propertyName, attributes);
+}
+
+void QScriptActivationObject::getPropertyNames(JSC::ExecState* exec, JSC::PropertyNameArray& propertyNames, unsigned listedAttributes)
+{
+ if (d_ptr()->delegate != 0) {
+ d_ptr()->delegate->getPropertyNames(exec, propertyNames, listedAttributes);
+ return;
+ }
+ return JSC::JSVariableObject::getPropertyNames(exec, propertyNames, listedAttributes);
+}
+
void QScriptActivationObject::putWithAttributes(JSC::ExecState *exec, const JSC::Identifier &propertyName, JSC::JSValue value, unsigned attributes)
{
+ if (d_ptr()->delegate != 0) {
+ d_ptr()->delegate->putWithAttributes(exec, propertyName, value, attributes);
+ return;
+ }
+
if (symbolTablePutWithAttributes(propertyName, value, attributes))
return;
@@ -82,6 +111,31 @@ void QScriptActivationObject::putWithAttributes(JSC::ExecState *exec, const JSC:
JSObject::putWithAttributes(exec, propertyName, value, attributes, true, slot);
}
+void QScriptActivationObject::put(JSC::ExecState* exec, const JSC::Identifier& propertyName, JSC::JSValue value, JSC::PutPropertySlot& slot)
+{
+ if (d_ptr()->delegate != 0) {
+ d_ptr()->delegate->put(exec, propertyName, value, slot);
+ return;
+ }
+ JSC::JSVariableObject::put(exec, propertyName, value, slot);
+}
+
+void QScriptActivationObject::put(JSC::ExecState* exec, unsigned propertyName, JSC::JSValue value)
+{
+ if (d_ptr()->delegate != 0) {
+ d_ptr()->delegate->put(exec, propertyName, value);
+ return;
+ }
+ JSC::JSVariableObject::put(exec, propertyName, value);
+}
+
+bool QScriptActivationObject::deleteProperty(JSC::ExecState* exec, const JSC::Identifier& propertyName, bool checkDontDelete)
+{
+ if (d_ptr()->delegate != 0)
+ return d_ptr()->delegate->deleteProperty(exec, propertyName, checkDontDelete);
+ return JSC::JSVariableObject::deleteProperty(exec, propertyName, checkDontDelete);
+}
+
} // namespace QScript
QT_END_NAMESPACE
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); }
};