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