1 | /****************************************************************************
|
---|
2 | **
|
---|
3 | ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
---|
4 | ** All rights reserved.
|
---|
5 | ** Contact: Nokia Corporation ([email protected])
|
---|
6 | **
|
---|
7 | ** This file is part of the QtScript module of the Qt Toolkit.
|
---|
8 | **
|
---|
9 | ** $QT_BEGIN_LICENSE:LGPL-ONLY$
|
---|
10 | ** GNU Lesser General Public License Usage
|
---|
11 | ** This file may be used under the terms of the GNU Lesser
|
---|
12 | ** General Public License version 2.1 as published by the Free Software
|
---|
13 | ** Foundation and appearing in the file LICENSE.LGPL included in the
|
---|
14 | ** packaging of this file. Please review the following information to
|
---|
15 | ** ensure the GNU Lesser General Public License version 2.1 requirements
|
---|
16 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
---|
17 | **
|
---|
18 | ** If you have questions regarding the use of this file, please contact
|
---|
19 | ** Nokia at [email protected].
|
---|
20 | ** $QT_END_LICENSE$
|
---|
21 | **
|
---|
22 | ****************************************************************************/
|
---|
23 |
|
---|
24 | #include "config.h"
|
---|
25 | #include "qscriptactivationobject_p.h"
|
---|
26 |
|
---|
27 | #include "JSVariableObject.h"
|
---|
28 |
|
---|
29 | namespace JSC
|
---|
30 | {
|
---|
31 | ASSERT_CLASS_FITS_IN_CELL(QT_PREPEND_NAMESPACE(QScript::QScriptActivationObject));
|
---|
32 | }
|
---|
33 |
|
---|
34 | QT_BEGIN_NAMESPACE
|
---|
35 |
|
---|
36 | /*!
|
---|
37 | \class QScript::QScriptActivationObject
|
---|
38 | \internal
|
---|
39 |
|
---|
40 | Represent a scope for native function call.
|
---|
41 | */
|
---|
42 |
|
---|
43 | namespace QScript
|
---|
44 | {
|
---|
45 |
|
---|
46 | const JSC::ClassInfo QScriptActivationObject::info = { "QScriptActivationObject", 0, 0, 0 };
|
---|
47 |
|
---|
48 | QScriptActivationObject::QScriptActivationObject(JSC::ExecState *callFrame, JSC::JSObject *delegate)
|
---|
49 | : JSC::JSVariableObject(callFrame->globalData().activationStructure,
|
---|
50 | new QScriptActivationObjectData(callFrame->registers(), delegate))
|
---|
51 | {
|
---|
52 | }
|
---|
53 |
|
---|
54 | QScriptActivationObject::~QScriptActivationObject()
|
---|
55 | {
|
---|
56 | delete d_ptr();
|
---|
57 | }
|
---|
58 |
|
---|
59 | bool QScriptActivationObject::getOwnPropertySlot(JSC::ExecState* exec, const JSC::Identifier& propertyName, JSC::PropertySlot& slot)
|
---|
60 | {
|
---|
61 | if (d_ptr()->delegate != 0)
|
---|
62 | return d_ptr()->delegate->getOwnPropertySlot(exec, propertyName, slot);
|
---|
63 | return JSC::JSVariableObject::getOwnPropertySlot(exec, propertyName, slot);
|
---|
64 | }
|
---|
65 |
|
---|
66 | bool QScriptActivationObject::getOwnPropertyDescriptor(JSC::ExecState* exec, const JSC::Identifier& propertyName, JSC::PropertyDescriptor& descriptor)
|
---|
67 | {
|
---|
68 | if (d_ptr()->delegate != 0)
|
---|
69 | return d_ptr()->delegate->getOwnPropertyDescriptor(exec, propertyName, descriptor);
|
---|
70 | return JSC::JSVariableObject::getOwnPropertyDescriptor(exec, propertyName, descriptor);
|
---|
71 | }
|
---|
72 |
|
---|
73 | void QScriptActivationObject::getOwnPropertyNames(JSC::ExecState* exec, JSC::PropertyNameArray& propertyNames, JSC::EnumerationMode mode)
|
---|
74 | {
|
---|
75 | if (d_ptr()->delegate != 0) {
|
---|
76 | d_ptr()->delegate->getOwnPropertyNames(exec, propertyNames, mode);
|
---|
77 | return;
|
---|
78 | }
|
---|
79 | return JSC::JSVariableObject::getOwnPropertyNames(exec, propertyNames, mode);
|
---|
80 | }
|
---|
81 |
|
---|
82 | void QScriptActivationObject::putWithAttributes(JSC::ExecState *exec, const JSC::Identifier &propertyName, JSC::JSValue value, unsigned attributes)
|
---|
83 | {
|
---|
84 | if (d_ptr()->delegate != 0) {
|
---|
85 | d_ptr()->delegate->putWithAttributes(exec, propertyName, value, attributes);
|
---|
86 | return;
|
---|
87 | }
|
---|
88 |
|
---|
89 | if (symbolTablePutWithAttributes(propertyName, value, attributes))
|
---|
90 | return;
|
---|
91 |
|
---|
92 | JSC::PutPropertySlot slot;
|
---|
93 | JSObject::putWithAttributes(exec, propertyName, value, attributes, true, slot);
|
---|
94 | }
|
---|
95 |
|
---|
96 | void QScriptActivationObject::put(JSC::ExecState* exec, const JSC::Identifier& propertyName, JSC::JSValue value, JSC::PutPropertySlot& slot)
|
---|
97 | {
|
---|
98 | if (d_ptr()->delegate != 0) {
|
---|
99 | d_ptr()->delegate->put(exec, propertyName, value, slot);
|
---|
100 | return;
|
---|
101 | }
|
---|
102 | JSC::JSVariableObject::put(exec, propertyName, value, slot);
|
---|
103 | }
|
---|
104 |
|
---|
105 | void QScriptActivationObject::put(JSC::ExecState* exec, unsigned propertyName, JSC::JSValue value)
|
---|
106 | {
|
---|
107 | if (d_ptr()->delegate != 0) {
|
---|
108 | d_ptr()->delegate->put(exec, propertyName, value);
|
---|
109 | return;
|
---|
110 | }
|
---|
111 | JSC::JSVariableObject::put(exec, propertyName, value);
|
---|
112 | }
|
---|
113 |
|
---|
114 | bool QScriptActivationObject::deleteProperty(JSC::ExecState* exec, const JSC::Identifier& propertyName)
|
---|
115 | {
|
---|
116 | if (d_ptr()->delegate != 0)
|
---|
117 | return d_ptr()->delegate->deleteProperty(exec, propertyName);
|
---|
118 | return JSC::JSVariableObject::deleteProperty(exec, propertyName);
|
---|
119 | }
|
---|
120 |
|
---|
121 | void QScriptActivationObject::defineGetter(JSC::ExecState* exec, const JSC::Identifier& propertyName, JSC::JSObject* getterFunction)
|
---|
122 | {
|
---|
123 | if (d_ptr()->delegate != 0)
|
---|
124 | d_ptr()->delegate->defineGetter(exec, propertyName, getterFunction);
|
---|
125 | else
|
---|
126 | JSC::JSVariableObject::defineGetter(exec, propertyName, getterFunction);
|
---|
127 | }
|
---|
128 |
|
---|
129 | void QScriptActivationObject::defineSetter(JSC::ExecState* exec, const JSC::Identifier& propertyName, JSC::JSObject* setterFunction)
|
---|
130 | {
|
---|
131 | if (d_ptr()->delegate != 0)
|
---|
132 | d_ptr()->delegate->defineSetter(exec, propertyName, setterFunction);
|
---|
133 | else
|
---|
134 | JSC::JSVariableObject::defineSetter(exec, propertyName, setterFunction);
|
---|
135 | }
|
---|
136 |
|
---|
137 | JSC::JSValue QScriptActivationObject::lookupGetter(JSC::ExecState* exec, const JSC::Identifier& propertyName)
|
---|
138 | {
|
---|
139 | if (d_ptr()->delegate != 0)
|
---|
140 | return d_ptr()->delegate->lookupGetter(exec, propertyName);
|
---|
141 | return JSC::JSVariableObject::lookupGetter(exec, propertyName);
|
---|
142 | }
|
---|
143 |
|
---|
144 | JSC::JSValue QScriptActivationObject::lookupSetter(JSC::ExecState* exec, const JSC::Identifier& propertyName)
|
---|
145 | {
|
---|
146 | if (d_ptr()->delegate != 0)
|
---|
147 | return d_ptr()->delegate->lookupSetter(exec, propertyName);
|
---|
148 | return JSC::JSVariableObject::lookupSetter(exec, propertyName);
|
---|
149 | }
|
---|
150 |
|
---|
151 | } // namespace QScript
|
---|
152 |
|
---|
153 | QT_END_NAMESPACE
|
---|
154 |
|
---|