Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/qml/jsapi/qjsvalueiterator.cpp |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | - | |||||||||||||
2 | - | |||||||||||||
3 | - | |||||||||||||
4 | QJSValueIteratorPrivate::QJSValueIteratorPrivate(const QJSValue &v) | - | ||||||||||||
5 | : value(v) | - | ||||||||||||
6 | , currentIndex( | - | ||||||||||||
7 | (0x7fffffff * 2U + 1U) | - | ||||||||||||
8 | ) | - | ||||||||||||
9 | , nextIndex( | - | ||||||||||||
10 | (0x7fffffff * 2U + 1U) | - | ||||||||||||
11 | ) | - | ||||||||||||
12 | { | - | ||||||||||||
13 | QV4::ExecutionEngine *e = QJSValuePrivate::engine(&v); | - | ||||||||||||
14 | if (!e
| 2-30 | ||||||||||||
15 | return; executed 2 times by 1 test: return; Executed by:
| 2 | ||||||||||||
16 | - | |||||||||||||
17 | QV4::Scope scope(e); | - | ||||||||||||
18 | QV4::ScopedObject o(scope, QJSValuePrivate::getValue(&v)); | - | ||||||||||||
19 | iterator.set(e, e->newForInIteratorObject(o)); | - | ||||||||||||
20 | } executed 30 times by 3 tests: end of block Executed by:
| 30 | ||||||||||||
21 | QJSValueIterator::QJSValueIterator(const QJSValue& object) | - | ||||||||||||
22 | : d_ptr(new QJSValueIteratorPrivate(object)) | - | ||||||||||||
23 | { | - | ||||||||||||
24 | QV4::ExecutionEngine *v4 = d_ptr->iterator.engine(); | - | ||||||||||||
25 | if (!v4
| 2-30 | ||||||||||||
26 | return; executed 2 times by 1 test: return; Executed by:
| 2 | ||||||||||||
27 | QV4::Scope scope(v4); | - | ||||||||||||
28 | QV4::Scoped<QV4::ForInIteratorObject> it(scope, d_ptr->iterator.value()); | - | ||||||||||||
29 | it->d()->it().flags = QV4::ObjectIterator::NoFlags; | - | ||||||||||||
30 | QV4::ScopedString nm(scope); | - | ||||||||||||
31 | QV4::Property nextProperty; | - | ||||||||||||
32 | QV4::PropertyAttributes nextAttributes; | - | ||||||||||||
33 | it->d()->it().next(nm.getRef(), &d_ptr->nextIndex, &nextProperty, &nextAttributes); | - | ||||||||||||
34 | d_ptr->nextName.set(v4, nm.asReturnedValue()); | - | ||||||||||||
35 | } executed 30 times by 3 tests: end of block Executed by:
| 30 | ||||||||||||
36 | - | |||||||||||||
37 | - | |||||||||||||
38 | - | |||||||||||||
39 | - | |||||||||||||
40 | QJSValueIterator::~QJSValueIterator() | - | ||||||||||||
41 | { | - | ||||||||||||
42 | } | - | ||||||||||||
43 | bool QJSValueIterator::hasNext() const | - | ||||||||||||
44 | { | - | ||||||||||||
45 | QV4::Value *val = QJSValuePrivate::getValue(&d_ptr->value); | - | ||||||||||||
46 | if (!val
| 4-210 | ||||||||||||
47 | return executed 8 times by 2 tests: false;return false; Executed by:
executed 8 times by 2 tests: return false; Executed by:
| 8 | ||||||||||||
48 | return executed 206 times by 3 tests: d_ptr->nextName.as<QV4::String>() || d_ptr->nextIndex != return d_ptr->nextName.as<QV4::String>() || d_ptr->nextIndex != (0x7fffffff * 2U + 1U) ; Executed by:
executed 206 times by 3 tests: return d_ptr->nextName.as<QV4::String>() || d_ptr->nextIndex != (0x7fffffff * 2U + 1U) ; Executed by:
| 206 | ||||||||||||
49 | (0x7fffffff * 2U + 1U) executed 206 times by 3 tests: return d_ptr->nextName.as<QV4::String>() || d_ptr->nextIndex != (0x7fffffff * 2U + 1U) ; Executed by:
| 206 | ||||||||||||
50 | ; executed 206 times by 3 tests: return d_ptr->nextName.as<QV4::String>() || d_ptr->nextIndex != (0x7fffffff * 2U + 1U) ; Executed by:
| 206 | ||||||||||||
51 | } | - | ||||||||||||
52 | bool QJSValueIterator::next() | - | ||||||||||||
53 | { | - | ||||||||||||
54 | QV4::Value *val = QJSValuePrivate::getValue(&d_ptr->value); | - | ||||||||||||
55 | if (!val
| 2-176 | ||||||||||||
56 | return executed 4 times by 1 test: false;return false; Executed by:
executed 4 times by 1 test: return false; Executed by:
| 4 | ||||||||||||
57 | d_ptr->currentName = d_ptr->nextName; | - | ||||||||||||
58 | d_ptr->currentIndex = d_ptr->nextIndex; | - | ||||||||||||
59 | - | |||||||||||||
60 | QV4::ExecutionEngine *v4 = d_ptr->iterator.engine(); | - | ||||||||||||
61 | if (!v4
| 0-174 | ||||||||||||
62 | return never executed: false;return false; never executed: return false; | 0 | ||||||||||||
63 | QV4::Scope scope(v4); | - | ||||||||||||
64 | QV4::Scoped<QV4::ForInIteratorObject> it(scope, d_ptr->iterator.value()); | - | ||||||||||||
65 | QV4::ScopedString nm(scope); | - | ||||||||||||
66 | QV4::Property nextProperty; | - | ||||||||||||
67 | QV4::PropertyAttributes nextAttributes; | - | ||||||||||||
68 | it->d()->it().next(nm.getRef(), &d_ptr->nextIndex, &nextProperty, &nextAttributes); | - | ||||||||||||
69 | d_ptr->nextName.set(v4, nm.asReturnedValue()); | - | ||||||||||||
70 | return executed 174 times by 3 tests: d_ptr->currentName.as<QV4::String>() || d_ptr->currentIndex != return d_ptr->currentName.as<QV4::String>() || d_ptr->currentIndex != (0x7fffffff * 2U + 1U) ; Executed by:
executed 174 times by 3 tests: return d_ptr->currentName.as<QV4::String>() || d_ptr->currentIndex != (0x7fffffff * 2U + 1U) ; Executed by:
| 174 | ||||||||||||
71 | (0x7fffffff * 2U + 1U) executed 174 times by 3 tests: return d_ptr->currentName.as<QV4::String>() || d_ptr->currentIndex != (0x7fffffff * 2U + 1U) ; Executed by:
| 174 | ||||||||||||
72 | ; executed 174 times by 3 tests: return d_ptr->currentName.as<QV4::String>() || d_ptr->currentIndex != (0x7fffffff * 2U + 1U) ; Executed by:
| 174 | ||||||||||||
73 | } | - | ||||||||||||
74 | - | |||||||||||||
75 | - | |||||||||||||
76 | - | |||||||||||||
77 | - | |||||||||||||
78 | - | |||||||||||||
79 | - | |||||||||||||
80 | - | |||||||||||||
81 | QString QJSValueIterator::name() const | - | ||||||||||||
82 | { | - | ||||||||||||
83 | QV4::Value *val = QJSValuePrivate::getValue(&d_ptr->value); | - | ||||||||||||
84 | if (!val
| 2-186 | ||||||||||||
85 | return executed 6 times by 1 test: QString();return QString(); Executed by:
executed 6 times by 1 test: return QString(); Executed by:
| 6 | ||||||||||||
86 | if (QV4::String *s = d_ptr->currentName.as<QV4::String>()
| 20-162 | ||||||||||||
87 | return executed 162 times by 3 tests: s->toQString();return s->toQString(); Executed by:
executed 162 times by 3 tests: return s->toQString(); Executed by:
| 162 | ||||||||||||
88 | if (d_ptr->currentIndex <
| 0-20 | ||||||||||||
89 | (0x7fffffff * 2U + 1U)
| 0-20 | ||||||||||||
90 | ) | - | ||||||||||||
91 | return executed 20 times by 1 test: QString::number(d_ptr->currentIndex);return QString::number(d_ptr->currentIndex); Executed by:
executed 20 times by 1 test: return QString::number(d_ptr->currentIndex); Executed by:
| 20 | ||||||||||||
92 | return never executed: QString();return QString(); never executed: return QString(); | 0 | ||||||||||||
93 | } | - | ||||||||||||
94 | QJSValue QJSValueIterator::value() const | - | ||||||||||||
95 | { | - | ||||||||||||
96 | QV4::ExecutionEngine *engine = d_ptr->iterator.engine(); | - | ||||||||||||
97 | if (!engine
| 6-68 | ||||||||||||
98 | return executed 6 times by 1 test: QJSValue();return QJSValue(); Executed by:
executed 6 times by 1 test: return QJSValue(); Executed by:
| 6 | ||||||||||||
99 | QV4::Scope scope(engine); | - | ||||||||||||
100 | QV4::ScopedObject obj(scope, QJSValuePrivate::getValue(&d_ptr->value)); | - | ||||||||||||
101 | if (!obj
| 0-68 | ||||||||||||
102 | return never executed: QJSValue();return QJSValue(); never executed: return QJSValue(); | 0 | ||||||||||||
103 | - | |||||||||||||
104 | if (!d_ptr->currentName.as<QV4::String>()
| 0-40 | ||||||||||||
105 | (0x7fffffff * 2U + 1U)
| 0-40 | ||||||||||||
106 | ) | - | ||||||||||||
107 | return never executed: QJSValue();return QJSValue(); never executed: return QJSValue(); | 0 | ||||||||||||
108 | - | |||||||||||||
109 | QV4::ScopedValue v(scope, d_ptr->currentIndex == | - | ||||||||||||
110 | (0x7fffffff * 2U + 1U) | - | ||||||||||||
111 | ? obj->get(d_ptr->currentName.as<QV4::String>()) : obj->get(d_ptr->currentIndex)); | - | ||||||||||||
112 | if (scope.hasException()
| 0-68 | ||||||||||||
113 | engine->catchException(); | - | ||||||||||||
114 | return never executed: QJSValue();return QJSValue(); never executed: return QJSValue(); | 0 | ||||||||||||
115 | } | - | ||||||||||||
116 | return executed 68 times by 1 test: QJSValue(engine, v->asReturnedValue());return QJSValue(engine, v->asReturnedValue()); Executed by:
executed 68 times by 1 test: return QJSValue(engine, v->asReturnedValue()); Executed by:
| 68 | ||||||||||||
117 | } | - | ||||||||||||
118 | - | |||||||||||||
119 | - | |||||||||||||
120 | - | |||||||||||||
121 | - | |||||||||||||
122 | - | |||||||||||||
123 | - | |||||||||||||
124 | - | |||||||||||||
125 | QJSValueIterator& QJSValueIterator::operator=(QJSValue& object) | - | ||||||||||||
126 | { | - | ||||||||||||
127 | d_ptr->value = object; | - | ||||||||||||
128 | d_ptr->currentIndex = | - | ||||||||||||
129 | (0x7fffffff * 2U + 1U) | - | ||||||||||||
130 | ; | - | ||||||||||||
131 | d_ptr->nextIndex = | - | ||||||||||||
132 | (0x7fffffff * 2U + 1U) | - | ||||||||||||
133 | ; | - | ||||||||||||
134 | d_ptr->currentName.clear(); | - | ||||||||||||
135 | d_ptr->nextName.clear(); | - | ||||||||||||
136 | QV4::ExecutionEngine *v4 = d_ptr->iterator.engine(); | - | ||||||||||||
137 | if (!v4
| 2-16 | ||||||||||||
138 | d_ptr->iterator.clear(); | - | ||||||||||||
139 | return executed 2 times by 1 test: *this;return *this; Executed by:
executed 2 times by 1 test: return *this; Executed by:
| 2 | ||||||||||||
140 | } | - | ||||||||||||
141 | - | |||||||||||||
142 | QV4::Scope scope(v4); | - | ||||||||||||
143 | QV4::ScopedObject o(scope, QJSValuePrivate::getValue(&object)); | - | ||||||||||||
144 | d_ptr->iterator.set(v4, v4->newForInIteratorObject(o)); | - | ||||||||||||
145 | QV4::Scoped<QV4::ForInIteratorObject> it(scope, d_ptr->iterator.value()); | - | ||||||||||||
146 | it->d()->it().flags = QV4::ObjectIterator::NoFlags; | - | ||||||||||||
147 | QV4::ScopedString nm(scope); | - | ||||||||||||
148 | QV4::Property nextProperty; | - | ||||||||||||
149 | QV4::PropertyAttributes nextAttributes; | - | ||||||||||||
150 | it->d()->it().next(nm.getRef(), &d_ptr->nextIndex, &nextProperty, &nextAttributes); | - | ||||||||||||
151 | d_ptr->nextName.set(v4, nm.asReturnedValue()); | - | ||||||||||||
152 | return executed 16 times by 1 test: *this;return *this; Executed by:
executed 16 times by 1 test: return *this; Executed by:
| 16 | ||||||||||||
153 | } | - | ||||||||||||
154 | - | |||||||||||||
155 | - | |||||||||||||
Switch to Source code | Preprocessed file |