Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/qml/jsruntime/qv4objectiterator_p.h |
Source code | Switch to Preprocessed file |
Line | Source | Count |
---|---|---|
1 | /**************************************************************************** | - |
2 | ** | - |
3 | ** Copyright (C) 2016 The Qt Company Ltd. | - |
4 | ** Contact: https://www.qt.io/licensing/ | - |
5 | ** | - |
6 | ** This file is part of the QtQml module of the Qt Toolkit. | - |
7 | ** | - |
8 | ** $QT_BEGIN_LICENSE:LGPL$ | - |
9 | ** Commercial License Usage | - |
10 | ** Licensees holding valid commercial Qt licenses may use this file in | - |
11 | ** accordance with the commercial license agreement provided with the | - |
12 | ** Software or, alternatively, in accordance with the terms contained in | - |
13 | ** a written agreement between you and The Qt Company. For licensing terms | - |
14 | ** and conditions see https://www.qt.io/terms-conditions. For further | - |
15 | ** information use the contact form at https://www.qt.io/contact-us. | - |
16 | ** | - |
17 | ** GNU Lesser General Public License Usage | - |
18 | ** Alternatively, this file may be used under the terms of the GNU Lesser | - |
19 | ** General Public License version 3 as published by the Free Software | - |
20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the | - |
21 | ** packaging of this file. Please review the following information to | - |
22 | ** ensure the GNU Lesser General Public License version 3 requirements | - |
23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. | - |
24 | ** | - |
25 | ** GNU General Public License Usage | - |
26 | ** Alternatively, this file may be used under the terms of the GNU | - |
27 | ** General Public License version 2.0 or (at your option) the GNU General | - |
28 | ** Public license version 3 or any later version approved by the KDE Free | - |
29 | ** Qt Foundation. The licenses are as published by the Free Software | - |
30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 | - |
31 | ** included in the packaging of this file. Please review the following | - |
32 | ** information to ensure the GNU General Public License requirements will | - |
33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and | - |
34 | ** https://www.gnu.org/licenses/gpl-3.0.html. | - |
35 | ** | - |
36 | ** $QT_END_LICENSE$ | - |
37 | ** | - |
38 | ****************************************************************************/ | - |
39 | #ifndef QV4OBJECTITERATOR_H | - |
40 | #define QV4OBJECTITERATOR_H | - |
41 | - | |
42 | // | - |
43 | // W A R N I N G | - |
44 | // ------------- | - |
45 | // | - |
46 | // This file is not part of the Qt API. It exists purely as an | - |
47 | // implementation detail. This header file may change from version to | - |
48 | // version without notice, or even be removed. | - |
49 | // | - |
50 | // We mean it. | - |
51 | // | - |
52 | - | |
53 | #include "qv4global_p.h" | - |
54 | #include "qv4object_p.h" | - |
55 | - | |
56 | QT_BEGIN_NAMESPACE | - |
57 | - | |
58 | namespace QV4 { | - |
59 | - | |
60 | struct Q_QML_EXPORT ObjectIteratorData | - |
61 | { | - |
62 | enum Flags { | - |
63 | NoFlags = 0, | - |
64 | EnumerableOnly = 0x1, | - |
65 | WithProtoChain = 0x2, | - |
66 | }; | - |
67 | - | |
68 | ExecutionEngine *engine; | - |
69 | Value *object; | - |
70 | Value *current; | - |
71 | SparseArrayNode *arrayNode; | - |
72 | uint arrayIndex; | - |
73 | uint memberIndex; | - |
74 | uint flags; | - |
75 | }; | - |
76 | Q_STATIC_ASSERT(std::is_trivial< ObjectIteratorData >::value); | - |
77 | - | |
78 | struct Q_QML_EXPORT ObjectIterator: ObjectIteratorData | - |
79 | { | - |
80 | ObjectIterator(ExecutionEngine *e, Value *scratch1, Value *scratch2, Object *o, uint flags) | - |
81 | { | - |
82 | engine = e; | - |
83 | object = scratch1; | - |
84 | current = scratch2; | - |
85 | arrayNode = nullptr; | - |
86 | arrayIndex = 0; | - |
87 | memberIndex = 0; | - |
88 | this->flags = flags; | - |
89 | init(o); | - |
90 | } executed 9115 times by 14 tests: end of block Executed by:
| 9115 |
91 | - | |
92 | ObjectIterator(Scope &scope, const Object *o, uint flags) | - |
93 | { | - |
94 | engine = scope.engine; | - |
95 | object = scope.alloc(); | - |
96 | current = scope.alloc(); | - |
97 | arrayNode = nullptr; | - |
98 | arrayIndex = 0; | - |
99 | memberIndex = 0; | - |
100 | this->flags = flags; | - |
101 | init(o); | - |
102 | } executed 17129 times by 27 tests: end of block Executed by:
| 17129 |
103 | - | |
104 | void next(Value *name, uint *index, Property *pd, PropertyAttributes *attributes = nullptr); | - |
105 | ReturnedValue nextPropertyName(Value *value); | - |
106 | ReturnedValue nextPropertyNameAsString(Value *value); | - |
107 | ReturnedValue nextPropertyNameAsString(); | - |
108 | - | |
109 | private: | - |
110 | void init(const Object *o); | - |
111 | }; | - |
112 | - | |
113 | namespace Heap { | - |
114 | struct ForInIteratorObject : Object { | - |
115 | void init(QV4::Object *o); | - |
116 | ObjectIterator &it() { return *reinterpret_cast<ObjectIterator*>(&itData); } executed 34157 times by 14 tests: return *reinterpret_cast<ObjectIterator*>(&itData); Executed by:
| 34157 |
117 | Value workArea[2]; | - |
118 | - | |
119 | static void markObjects(Heap::Base *that, MarkStack *markStack); | - |
120 | private: | - |
121 | ObjectIteratorData itData; | - |
122 | }; | - |
123 | - | |
124 | } | - |
125 | - | |
126 | struct ForInIteratorPrototype : Object | - |
127 | { | - |
128 | V4_PROTOTYPE(iteratorPrototype) never executed: return e->iteratorPrototype(); | 0 |
129 | void init(ExecutionEngine *engine); | - |
130 | - | |
131 | static ReturnedValue method_next(const FunctionObject *b, const Value *thisObject, const Value *argv, int argc); | - |
132 | }; | - |
133 | - | |
134 | struct ForInIteratorObject: Object { | - |
135 | V4_OBJECT2(ForInIteratorObject, Object) executed 24924 times by 14 tests: end of block Executed by:
never executed: end of block executed 52354 times by 14 tests: return &static_vtbl; Executed by:
executed 43269 times by 14 tests: return static_cast<QV4::Heap::ForInIteratorObject *>(m()); Executed by:
executed 34152 times by 14 tests: return dptr; Executed by:
| 0-52354 |
136 | Q_MANAGED_TYPE(ForInIterator) | - |
137 | V4_PROTOTYPE(forInIteratorPrototype) executed 9154 times by 14 tests: return e->forInIteratorPrototype(); Executed by:
| 9154 |
138 | - | |
139 | ReturnedValue nextPropertyName() const { return d()->it().nextPropertyNameAsString(); } executed 24707 times by 12 tests: return d()->it().nextPropertyNameAsString(); Executed by:
| 24707 |
140 | }; | - |
141 | - | |
142 | inline | - |
143 | void Heap::ForInIteratorObject::init(QV4::Object *o) | - |
144 | { | - |
145 | Object::init(); | - |
146 | it() = ObjectIterator(internalClass->engine, workArea, workArea + 1, o, | - |
147 | ObjectIterator::EnumerableOnly | ObjectIterator::WithProtoChain); | - |
148 | } executed 9116 times by 14 tests: end of block Executed by:
| 9116 |
149 | - | |
150 | - | |
151 | } | - |
152 | - | |
153 | QT_END_NAMESPACE | - |
154 | - | |
155 | #endif | - |
Source code | Switch to Preprocessed file |