|
1 /**************************************************************************** |
|
2 ** |
|
3 ** Copyright (C) 2010 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-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 qt-info@nokia.com. |
|
20 ** $QT_END_LICENSE$ |
|
21 ** |
|
22 ****************************************************************************/ |
|
23 |
|
24 #ifndef QSCRIPTSTATICSCOPEOBJECT_P_H |
|
25 #define QSCRIPTSTATICSCOPEOBJECT_P_H |
|
26 |
|
27 // |
|
28 // W A R N I N G |
|
29 // ------------- |
|
30 // |
|
31 // This file is not part of the Qt API. It exists purely as an |
|
32 // implementation detail. This header file may change from version to |
|
33 // version without notice, or even be removed. |
|
34 // |
|
35 // We mean it. |
|
36 // |
|
37 |
|
38 #include <QtCore/qobjectdefs.h> |
|
39 |
|
40 #include "JSVariableObject.h" |
|
41 |
|
42 QT_BEGIN_NAMESPACE |
|
43 |
|
44 class QScriptStaticScopeObject : public JSC::JSVariableObject { |
|
45 public: |
|
46 struct PropertyInfo { |
|
47 PropertyInfo(const JSC::Identifier& i, JSC::JSValue v, unsigned a) |
|
48 : identifier(i), value(v), attributes(a) |
|
49 { } |
|
50 PropertyInfo() {} |
|
51 |
|
52 JSC::Identifier identifier; |
|
53 JSC::JSValue value; |
|
54 unsigned attributes; |
|
55 }; |
|
56 |
|
57 QScriptStaticScopeObject(WTF::NonNullPassRefPtr<JSC::Structure> structure, |
|
58 int propertyCount, const PropertyInfo*); |
|
59 QScriptStaticScopeObject(WTF::NonNullPassRefPtr<JSC::Structure> structure); |
|
60 virtual ~QScriptStaticScopeObject(); |
|
61 |
|
62 virtual bool isDynamicScope() const { return false; } |
|
63 |
|
64 virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertySlot&); |
|
65 virtual bool getOwnPropertyDescriptor(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertyDescriptor&); |
|
66 |
|
67 virtual void putWithAttributes(JSC::ExecState *exec, const JSC::Identifier &propertyName, JSC::JSValue value, unsigned attributes); |
|
68 virtual void put(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::JSValue value, JSC::PutPropertySlot&); |
|
69 |
|
70 virtual bool deleteProperty(JSC::ExecState*, const JSC::Identifier& propertyName); |
|
71 |
|
72 virtual void markChildren(JSC::MarkStack&); |
|
73 |
|
74 virtual const JSC::ClassInfo* classInfo() const { return &info; } |
|
75 static const JSC::ClassInfo info; |
|
76 |
|
77 static WTF::PassRefPtr<JSC::Structure> createStructure(JSC::JSValue proto) { |
|
78 return JSC::Structure::create(proto, JSC::TypeInfo(JSC::ObjectType, StructureFlags)); |
|
79 } |
|
80 |
|
81 protected: |
|
82 static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | JSC::NeedsThisConversion | JSC::OverridesMarkChildren | JSC::OverridesGetPropertyNames | JSC::JSVariableObject::StructureFlags; |
|
83 |
|
84 struct Data : public JSVariableObjectData { |
|
85 Data(bool canGrow_) |
|
86 : JSVariableObjectData(&symbolTable, /*registers=*/0), |
|
87 canGrow(canGrow_), registerArraySize(0) |
|
88 { } |
|
89 bool canGrow; |
|
90 int registerArraySize; |
|
91 JSC::SymbolTable symbolTable; |
|
92 }; |
|
93 |
|
94 Data* d_ptr() const { return static_cast<Data*>(JSVariableObject::d); } |
|
95 |
|
96 private: |
|
97 void addSymbolTableProperty(const JSC::Identifier&, JSC::JSValue, unsigned attributes); |
|
98 int growRegisterArray(int); |
|
99 }; |
|
100 |
|
101 QT_END_NAMESPACE |
|
102 |
|
103 #endif |