diff options
author | Olivier Goffart <ogoffart@trolltech.com> | 2009-07-30 19:50:17 (GMT) |
---|---|---|
committer | Olivier Goffart <ogoffart@trolltech.com> | 2009-07-31 14:11:29 (GMT) |
commit | bb1e71ac344b184d2ab13cd0ed7188eebb34aaf1 (patch) | |
tree | e2481d6ab859207c3cef2dd2822f9e0cb65da5cd /src/script/bridge/qscriptactivationobject_p.h | |
parent | f6713c0e69d2b2b20da00e9a9a4e23a8f4f85c3d (diff) | |
download | Qt-bb1e71ac344b184d2ab13cd0ed7188eebb34aaf1.zip Qt-bb1e71ac344b184d2ab13cd0ed7188eebb34aaf1.tar.gz Qt-bb1e71ac344b184d2ab13cd0ed7188eebb34aaf1.tar.bz2 |
Small Refactoring of QScript
- Create a scope (activation object) for the native constructor in QScriptClass
- put the isCalledasConstructor in the activation object (so i can
clean up the QScriptContext
- Remove the code duplication in all native functions.
Aknoweldged-by: Kent
Diffstat (limited to 'src/script/bridge/qscriptactivationobject_p.h')
-rw-r--r-- | src/script/bridge/qscriptactivationobject_p.h | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/script/bridge/qscriptactivationobject_p.h b/src/script/bridge/qscriptactivationobject_p.h index 633cbf6..4e277dc 100644 --- a/src/script/bridge/qscriptactivationobject_p.h +++ b/src/script/bridge/qscriptactivationobject_p.h @@ -61,8 +61,6 @@ QT_BEGIN_NAMESPACE -class QScriptClass; - namespace QScript { @@ -72,15 +70,22 @@ public: virtual ~QScriptActivationObject(); virtual bool isDynamicScope() const { return true; } virtual void putWithAttributes(JSC::ExecState *exec, const JSC::Identifier &propertyName, JSC::JSValue value, unsigned attributes); -private: + + virtual const JSC::ClassInfo* classInfo() const { return &info; } + static const JSC::ClassInfo info; + struct QScriptActivationObjectData : public JSVariableObjectData { QScriptActivationObjectData(JSC::Register* registers) - : JSVariableObjectData(&symbolTable, registers) + : JSVariableObjectData(&symbolTable, registers), calledAsConstructor(false) { } JSC::SymbolTable symbolTable; + + //specifies if the context of this activation object is called as constructor + bool calledAsConstructor; }; -}; + QScriptActivationObjectData *d_ptr() const { return static_cast<QScriptActivationObjectData *>(d); } +}; } // namespace QScript |