OpenCoverage

qqmltypewrapper.cpp

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/qml/qml/qqmltypewrapper.cpp
Source codeSwitch to Preprocessed file
LineSourceCount
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-
40#include "qqmltypewrapper_p.h"-
41#include <private/qv8engine_p.h>-
42-
43#include <private/qqmlengine_p.h>-
44#include <private/qqmlcontext_p.h>-
45-
46#include <private/qjsvalue_p.h>-
47#include <private/qv4functionobject_p.h>-
48#include <private/qv4objectproto_p.h>-
49#include <private/qv4qobjectwrapper_p.h>-
50-
51QT_BEGIN_NAMESPACE-
52-
53using namespace QV4;-
54-
55DEFINE_OBJECT_VTABLE(QQmlTypeWrapper);-
56DEFINE_OBJECT_VTABLE(QQmlScopedEnumWrapper);-
57-
58void Heap::QQmlTypeWrapper::init()-
59{-
60 Object::init();-
61 mode = IncludeEnums;-
62 object.init();-
63}
executed 149836 times by 42 tests: end of block
Executed by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qmldiskcache
  • tst_qqmlcomponent
  • tst_qqmlconnections
  • tst_qqmlconsole
  • tst_qqmlcontext
  • tst_qqmlecmascript
  • tst_qqmlmetatype
  • tst_qqmlqt
  • tst_qqmlsqldatabase
  • tst_qqmlstatemachine
  • tst_qqmltypeloader
  • tst_qqmlvaluetypeproviders
  • tst_qqmlvaluetypes
  • tst_qqmlxmlhttprequest
  • tst_qquickaccessible
  • tst_qquickanimatedimage
  • tst_qquickanimationcontroller
  • tst_qquickanimations
  • tst_qquickbehaviors
  • tst_qquickdrag
  • tst_qquickdroparea
  • tst_qquickflipable
  • tst_qquickgraphicsinfo
  • ...
149836
64-
65void Heap::QQmlTypeWrapper::destroy()-
66{-
67 QQmlType::derefHandle(typePrivate);-
68 typePrivate = nullptr;-
69 if (typeNamespace)
typeNamespaceDescription
TRUEevaluated 324 times by 5 tests
Evaluated by:
  • tst_qqmlconnections
  • tst_qqmlecmascript
  • tst_qqmlsqldatabase
  • tst_qqmlvaluetypes
  • tst_qquickscreen
FALSEevaluated 149504 times by 42 tests
Evaluated by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qmldiskcache
  • tst_qqmlcomponent
  • tst_qqmlconnections
  • tst_qqmlconsole
  • tst_qqmlcontext
  • tst_qqmlecmascript
  • tst_qqmlmetatype
  • tst_qqmlqt
  • tst_qqmlsqldatabase
  • tst_qqmlstatemachine
  • tst_qqmltypeloader
  • tst_qqmlvaluetypeproviders
  • tst_qqmlvaluetypes
  • tst_qqmlxmlhttprequest
  • tst_qquickaccessible
  • tst_qquickanimatedimage
  • tst_qquickanimationcontroller
  • tst_qquickanimations
  • tst_qquickbehaviors
  • tst_qquickdrag
  • tst_qquickdroparea
  • tst_qquickflipable
  • tst_qquickgraphicsinfo
  • ...
324-149504
70 typeNamespace->release();
executed 324 times by 5 tests: typeNamespace->release();
Executed by:
  • tst_qqmlconnections
  • tst_qqmlecmascript
  • tst_qqmlsqldatabase
  • tst_qqmlvaluetypes
  • tst_qquickscreen
324
71 object.destroy();-
72 Object::destroy();-
73}
executed 149828 times by 42 tests: end of block
Executed by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qmldiskcache
  • tst_qqmlcomponent
  • tst_qqmlconnections
  • tst_qqmlconsole
  • tst_qqmlcontext
  • tst_qqmlecmascript
  • tst_qqmlmetatype
  • tst_qqmlqt
  • tst_qqmlsqldatabase
  • tst_qqmlstatemachine
  • tst_qqmltypeloader
  • tst_qqmlvaluetypeproviders
  • tst_qqmlvaluetypes
  • tst_qqmlxmlhttprequest
  • tst_qquickaccessible
  • tst_qquickanimatedimage
  • tst_qquickanimationcontroller
  • tst_qquickanimations
  • tst_qquickbehaviors
  • tst_qquickdrag
  • tst_qquickdroparea
  • tst_qquickflipable
  • tst_qquickgraphicsinfo
  • ...
149828
74-
75QQmlType Heap::QQmlTypeWrapper::type() const-
76{-
77 return QQmlType(typePrivate);
executed 149874 times by 42 tests: return QQmlType(typePrivate);
Executed by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qmldiskcache
  • tst_qqmlcomponent
  • tst_qqmlconnections
  • tst_qqmlconsole
  • tst_qqmlcontext
  • tst_qqmlecmascript
  • tst_qqmlmetatype
  • tst_qqmlqt
  • tst_qqmlsqldatabase
  • tst_qqmlstatemachine
  • tst_qqmltypeloader
  • tst_qqmlvaluetypeproviders
  • tst_qqmlvaluetypes
  • tst_qqmlxmlhttprequest
  • tst_qquickaccessible
  • tst_qquickanimatedimage
  • tst_qquickanimationcontroller
  • tst_qquickanimations
  • tst_qquickbehaviors
  • tst_qquickdrag
  • tst_qquickdroparea
  • tst_qquickflipable
  • tst_qquickgraphicsinfo
  • ...
149874
78}-
79-
80bool QQmlTypeWrapper::isSingleton() const-
81{-
82 return d()->type().isSingleton();
executed 32 times by 2 tests: return d()->type().isSingleton();
Executed by:
  • tst_qqmlconnections
  • tst_qqmlecmascript
32
83}-
84-
85QObject* QQmlTypeWrapper::singletonObject() const-
86{-
87 if (!isSingleton())
!isSingleton()Description
TRUEnever evaluated
FALSEnever evaluated
0
88 return nullptr;
never executed: return nullptr;
0
89-
90 QQmlEngine *e = engine()->qmlEngine();-
91 QQmlType::SingletonInstanceInfo *siinfo = d()->type().singletonInstanceInfo();-
92 siinfo->init(e);-
93 return siinfo->qobjectApi(e);
never executed: return siinfo->qobjectApi(e);
0
94}-
95-
96QVariant QQmlTypeWrapper::toVariant() const-
97{-
98 // Only Singleton type wrappers can be converted to a variant.-
99 if (!isSingleton())
!isSingleton()Description
TRUEnever evaluated
FALSEevaluated 30 times by 2 tests
Evaluated by:
  • tst_qqmlconnections
  • tst_qqmlecmascript
0-30
100 return QVariant();
never executed: return QVariant();
0
101-
102 QQmlEngine *e = engine()->qmlEngine();-
103 QQmlType::SingletonInstanceInfo *siinfo = d()->type().singletonInstanceInfo();-
104 siinfo->init(e);-
105 if (QObject *qobjectSingleton = siinfo->qobjectApi(e))
QObject *qobje...>qobjectApi(e)Description
TRUEevaluated 30 times by 2 tests
Evaluated by:
  • tst_qqmlconnections
  • tst_qqmlecmascript
FALSEnever evaluated
0-30
106 return QVariant::fromValue<QObject*>(qobjectSingleton);
executed 30 times by 2 tests: return QVariant::fromValue<QObject*>(qobjectSingleton);
Executed by:
  • tst_qqmlconnections
  • tst_qqmlecmascript
30
107-
108 return QVariant::fromValue<QJSValue>(siinfo->scriptApi(e));
never executed: return QVariant::fromValue<QJSValue>(siinfo->scriptApi(e));
0
109}-
110-
111-
112// Returns a type wrapper for type t on o. This allows access of enums, and attached properties.-
113ReturnedValue QQmlTypeWrapper::create(QV4::ExecutionEngine *engine, QObject *o, const QQmlType &t,-
114 Heap::QQmlTypeWrapper::TypeNameMode mode)-
115{-
116 Q_ASSERT(t.isValid());-
117 Scope scope(engine);-
118-
119 Scoped<QQmlTypeWrapper> w(scope, engine->memoryManager->allocate<QQmlTypeWrapper>());-
120 w->d()->mode = mode; w->d()->object = o;-
121 w->d()->typePrivate = t.priv();-
122 QQmlType::refHandle(w->d()->typePrivate);-
123 return w.asReturnedValue();
executed 149512 times by 42 tests: return w.asReturnedValue();
Executed by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qmldiskcache
  • tst_qqmlcomponent
  • tst_qqmlconnections
  • tst_qqmlconsole
  • tst_qqmlcontext
  • tst_qqmlecmascript
  • tst_qqmlmetatype
  • tst_qqmlqt
  • tst_qqmlsqldatabase
  • tst_qqmlstatemachine
  • tst_qqmltypeloader
  • tst_qqmlvaluetypeproviders
  • tst_qqmlvaluetypes
  • tst_qqmlxmlhttprequest
  • tst_qquickaccessible
  • tst_qquickanimatedimage
  • tst_qquickanimationcontroller
  • tst_qquickanimations
  • tst_qquickbehaviors
  • tst_qquickdrag
  • tst_qquickdroparea
  • tst_qquickflipable
  • tst_qquickgraphicsinfo
  • ...
149512
124}-
125-
126// Returns a type wrapper for importNamespace (of t) on o. This allows nested resolution of a type in a-
127// namespace.-
128ReturnedValue QQmlTypeWrapper::create(QV4::ExecutionEngine *engine, QObject *o, const QQmlRefPointer<QQmlTypeNameCache> &t, const QQmlImportRef *importNamespace,-
129 Heap::QQmlTypeWrapper::TypeNameMode mode)-
130{-
131 Q_ASSERT(t);-
132 Q_ASSERT(importNamespace);-
133 Scope scope(engine);-
134-
135 Scoped<QQmlTypeWrapper> w(scope, engine->memoryManager->allocate<QQmlTypeWrapper>());-
136 w->d()->mode = mode; w->d()->object = o; w->d()->typeNamespace = t.data(); w->d()->importNamespace = importNamespace;-
137 t->addref();-
138 return w.asReturnedValue();
executed 324 times by 5 tests: return w.asReturnedValue();
Executed by:
  • tst_qqmlconnections
  • tst_qqmlecmascript
  • tst_qqmlsqldatabase
  • tst_qqmlvaluetypes
  • tst_qquickscreen
324
139}-
140-
141static int enumForSingleton(QV4::ExecutionEngine *v4, String *name, QObject *qobjectSingleton,-
142 const QQmlType &type, bool *ok)-
143{-
144 Q_ASSERT(ok != nullptr);-
145 int value = type.enumValue(QQmlEnginePrivate::get(v4->qmlEngine()), name, ok);-
146 if (*ok)
*okDescription
TRUEevaluated 12 times by 2 tests
Evaluated by:
  • tst_qqmlecmascript
  • tst_qqmlmetatype
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qqmlecmascript
4-12
147 return value;
executed 12 times by 2 tests: return value;
Executed by:
  • tst_qqmlecmascript
  • tst_qqmlmetatype
12
148-
149 // ### Optimize-
150 QByteArray enumName = name->toQString().toUtf8();-
151 const QMetaObject *metaObject = qobjectSingleton->metaObject();-
152 for (int ii = metaObject->enumeratorCount() - 1; ii >= 0; --ii) {
ii >= 0Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qqmlecmascript
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qqmlecmascript
4
153 QMetaEnum e = metaObject->enumerator(ii);-
154 value = e.keyToValue(enumName.constData(), ok);-
155 if (*ok)
*okDescription
TRUEnever evaluated
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qqmlecmascript
0-4
156 return value;
never executed: return value;
0
157 }
executed 4 times by 1 test: end of block
Executed by:
  • tst_qqmlecmascript
4
158 *ok = false;-
159 return -1;
executed 4 times by 1 test: return -1;
Executed by:
  • tst_qqmlecmascript
4
160}-
161-
162static ReturnedValue throwLowercaseEnumError(QV4::ExecutionEngine *v4, String *name, const QQmlType &type)-
163{-
164 const QString message =-
165 QStringLiteral("Cannot access enum value '%1' of '%2', enum values need to start with an uppercase letter.")-
166 .arg(name->toQString()).arg(QLatin1String(type.typeName()));-
167 return v4->throwTypeError(message);
never executed: return v4->throwTypeError(message);
0
168}-
169-
170ReturnedValue QQmlTypeWrapper::virtualGet(const Managed *m, PropertyKey id, const Value *receiver, bool *hasProperty)-
171{-
172 Q_ASSERT(m->as<QQmlTypeWrapper>());-
173-
174 if (!id.isString())
!id.isString()Description
TRUEevaluated 56 times by 1 test
Evaluated by:
  • tst_qquicklayouts
FALSEevaluated 148572 times by 42 tests
Evaluated by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qmldiskcache
  • tst_qqmlcomponent
  • tst_qqmlconnections
  • tst_qqmlconsole
  • tst_qqmlcontext
  • tst_qqmlecmascript
  • tst_qqmlmetatype
  • tst_qqmlqt
  • tst_qqmlsqldatabase
  • tst_qqmlstatemachine
  • tst_qqmltypeloader
  • tst_qqmlvaluetypeproviders
  • tst_qqmlvaluetypes
  • tst_qqmlxmlhttprequest
  • tst_qquickaccessible
  • tst_qquickanimatedimage
  • tst_qquickanimationcontroller
  • tst_qquickanimations
  • tst_qquickbehaviors
  • tst_qquickdrag
  • tst_qquickdroparea
  • tst_qquickflipable
  • tst_qquickgraphicsinfo
  • ...
56-148572
175 return Object::virtualGet(m, id, receiver, hasProperty);
executed 56 times by 1 test: return Object::virtualGet(m, id, receiver, hasProperty);
Executed by:
  • tst_qquicklayouts
56
176-
177 QV4::ExecutionEngine *v4 = static_cast<const QQmlTypeWrapper *>(m)->engine();-
178 QV4::Scope scope(v4);-
179 ScopedString name(scope, id.asStringOrSymbol());-
180-
181 Scoped<QQmlTypeWrapper> w(scope, static_cast<const QQmlTypeWrapper *>(m));-
182-
183 if (hasProperty)
hasPropertyDescription
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_qqmlecmascript
FALSEevaluated 148566 times by 42 tests
Evaluated by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qmldiskcache
  • tst_qqmlcomponent
  • tst_qqmlconnections
  • tst_qqmlconsole
  • tst_qqmlcontext
  • tst_qqmlecmascript
  • tst_qqmlmetatype
  • tst_qqmlqt
  • tst_qqmlsqldatabase
  • tst_qqmlstatemachine
  • tst_qqmltypeloader
  • tst_qqmlvaluetypeproviders
  • tst_qqmlvaluetypes
  • tst_qqmlxmlhttprequest
  • tst_qquickaccessible
  • tst_qquickanimatedimage
  • tst_qquickanimationcontroller
  • tst_qquickanimations
  • tst_qquickbehaviors
  • tst_qquickdrag
  • tst_qquickdroparea
  • tst_qquickflipable
  • tst_qquickgraphicsinfo
  • ...
6-148566
184 *hasProperty = true;
executed 6 times by 1 test: *hasProperty = true;
Executed by:
  • tst_qqmlecmascript
6
185-
186 QQmlContextData *context = v4->callingQmlContext();-
187-
188 QObject *object = w->d()->object;-
189 QQmlType type = w->d()->type();-
190-
191 if (type.isValid()) {
type.isValid()Description
TRUEevaluated 148248 times by 41 tests
Evaluated by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qmldiskcache
  • tst_qqmlcomponent
  • tst_qqmlconsole
  • tst_qqmlcontext
  • tst_qqmlecmascript
  • tst_qqmlmetatype
  • tst_qqmlqt
  • tst_qqmlsqldatabase
  • tst_qqmlstatemachine
  • tst_qqmltypeloader
  • tst_qqmlvaluetypeproviders
  • tst_qqmlvaluetypes
  • tst_qqmlxmlhttprequest
  • tst_qquickaccessible
  • tst_qquickanimatedimage
  • tst_qquickanimationcontroller
  • tst_qquickanimations
  • tst_qquickbehaviors
  • tst_qquickdrag
  • tst_qquickdroparea
  • tst_qquickflipable
  • tst_qquickgraphicsinfo
  • tst_qquickgridview
  • ...
FALSEevaluated 324 times by 5 tests
Evaluated by:
  • tst_qqmlconnections
  • tst_qqmlecmascript
  • tst_qqmlsqldatabase
  • tst_qqmlvaluetypes
  • tst_qquickscreen
324-148248
192-
193 // singleton types are handled differently to other types.-
194 if (type.isSingleton()) {
type.isSingleton()Description
TRUEevaluated 446 times by 12 tests
Evaluated by:
  • tst_examples
  • tst_qmldiskcache
  • tst_qqmlcontext
  • tst_qqmlecmascript
  • tst_qqmlmetatype
  • tst_qqmlqt
  • tst_qqmlsqldatabase
  • tst_qqmltypeloader
  • tst_qquickanimationcontroller
  • tst_qquicklayouts
  • tst_quicktestmainwithsetup
  • tst_testfiltering
FALSEevaluated 147802 times by 34 tests
Evaluated by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlcomponent
  • tst_qqmlconsole
  • tst_qqmlecmascript
  • tst_qqmlqt
  • tst_qqmlstatemachine
  • tst_qqmltypeloader
  • tst_qqmlvaluetypeproviders
  • tst_qqmlvaluetypes
  • tst_qqmlxmlhttprequest
  • tst_qquickaccessible
  • tst_qquickanimatedimage
  • tst_qquickanimations
  • tst_qquickbehaviors
  • tst_qquickdrag
  • tst_qquickdroparea
  • tst_qquickflipable
  • tst_qquickgraphicsinfo
  • tst_qquickgridview
  • tst_qquickitem2
  • tst_qquicklayouts
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickmousearea
  • ...
446-147802
195 QQmlEngine *e = v4->qmlEngine();-
196 QQmlType::SingletonInstanceInfo *siinfo = type.singletonInstanceInfo();-
197 siinfo->init(e);-
198-
199 QObject *qobjectSingleton = siinfo->qobjectApi(e);-
200 if (qobjectSingleton) {
qobjectSingletonDescription
TRUEevaluated 418 times by 12 tests
Evaluated by:
  • tst_examples
  • tst_qmldiskcache
  • tst_qqmlcontext
  • tst_qqmlecmascript
  • tst_qqmlmetatype
  • tst_qqmlqt
  • tst_qqmlsqldatabase
  • tst_qqmltypeloader
  • tst_qquickanimationcontroller
  • tst_qquicklayouts
  • tst_quicktestmainwithsetup
  • tst_testfiltering
FALSEevaluated 28 times by 1 test
Evaluated by:
  • tst_qqmlecmascript
28-418
201-
202 // check for enum value-
203 const bool includeEnums = w->d()->mode == Heap::QQmlTypeWrapper::IncludeEnums;-
204 if (includeEnums && name->startsWithUpper()) {
includeEnumsDescription
TRUEevaluated 418 times by 12 tests
Evaluated by:
  • tst_examples
  • tst_qmldiskcache
  • tst_qqmlcontext
  • tst_qqmlecmascript
  • tst_qqmlmetatype
  • tst_qqmlqt
  • tst_qqmlsqldatabase
  • tst_qqmltypeloader
  • tst_qquickanimationcontroller
  • tst_qquicklayouts
  • tst_quicktestmainwithsetup
  • tst_testfiltering
FALSEnever evaluated
name->startsWithUpper()Description
TRUEevaluated 12 times by 2 tests
Evaluated by:
  • tst_qqmlecmascript
  • tst_qqmlmetatype
FALSEevaluated 406 times by 12 tests
Evaluated by:
  • tst_examples
  • tst_qmldiskcache
  • tst_qqmlcontext
  • tst_qqmlecmascript
  • tst_qqmlmetatype
  • tst_qqmlqt
  • tst_qqmlsqldatabase
  • tst_qqmltypeloader
  • tst_qquickanimationcontroller
  • tst_qquicklayouts
  • tst_quicktestmainwithsetup
  • tst_testfiltering
0-418
205 bool ok = false;-
206 const int value = enumForSingleton(v4, name, qobjectSingleton, type, &ok);-
207 if (ok)
okDescription
TRUEevaluated 12 times by 2 tests
Evaluated by:
  • tst_qqmlecmascript
  • tst_qqmlmetatype
FALSEnever evaluated
0-12
208 return QV4::Primitive::fromInt32(value).asReturnedValue();
executed 12 times by 2 tests: return QV4::Primitive::fromInt32(value).asReturnedValue();
Executed by:
  • tst_qqmlecmascript
  • tst_qqmlmetatype
12
209 }
never executed: end of block
0
210-
211 // check for property.-
212 bool ok;-
213 const ReturnedValue result = QV4::QObjectWrapper::getQmlProperty(v4, context, qobjectSingleton, name, QV4::QObjectWrapper::IgnoreRevision, &ok);-
214 if (hasProperty)
hasPropertyDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qqmlecmascript
FALSEevaluated 404 times by 12 tests
Evaluated by:
  • tst_examples
  • tst_qmldiskcache
  • tst_qqmlcontext
  • tst_qqmlecmascript
  • tst_qqmlmetatype
  • tst_qqmlqt
  • tst_qqmlsqldatabase
  • tst_qqmltypeloader
  • tst_qquickanimationcontroller
  • tst_qquicklayouts
  • tst_quicktestmainwithsetup
  • tst_testfiltering
2-404
215 *hasProperty = ok;
executed 2 times by 1 test: *hasProperty = ok;
Executed by:
  • tst_qqmlecmascript
2
216-
217 // Warn when attempting to access a lowercased enum value, singleton case-
218 if (!ok && includeEnums && !name->startsWithUpper()) {
!okDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qqmlecmascript
FALSEevaluated 402 times by 12 tests
Evaluated by:
  • tst_examples
  • tst_qmldiskcache
  • tst_qqmlcontext
  • tst_qqmlecmascript
  • tst_qqmlmetatype
  • tst_qqmlqt
  • tst_qqmlsqldatabase
  • tst_qqmltypeloader
  • tst_qquickanimationcontroller
  • tst_qquicklayouts
  • tst_quicktestmainwithsetup
  • tst_testfiltering
includeEnumsDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qqmlecmascript
FALSEnever evaluated
!name->startsWithUpper()Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qqmlecmascript
FALSEnever evaluated
0-402
219 enumForSingleton(v4, name, qobjectSingleton, type, &ok);-
220 if (ok)
okDescription
TRUEnever evaluated
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qqmlecmascript
0-4
221 return throwLowercaseEnumError(v4, name, type);
never executed: return throwLowercaseEnumError(v4, name, type);
0
222 }
executed 4 times by 1 test: end of block
Executed by:
  • tst_qqmlecmascript
4
223-
224 return result;
executed 406 times by 12 tests: return result;
Executed by:
  • tst_examples
  • tst_qmldiskcache
  • tst_qqmlcontext
  • tst_qqmlecmascript
  • tst_qqmlmetatype
  • tst_qqmlqt
  • tst_qqmlsqldatabase
  • tst_qqmltypeloader
  • tst_qquickanimationcontroller
  • tst_qquicklayouts
  • tst_quicktestmainwithsetup
  • tst_testfiltering
406
225 } else if (!siinfo->scriptApi(e).isUndefined()) {
!siinfo->scrip....isUndefined()Description
TRUEevaluated 28 times by 1 test
Evaluated by:
  • tst_qqmlecmascript
FALSEnever evaluated
0-28
226 // NOTE: if used in a binding, changes will not trigger re-evaluation since non-NOTIFYable.-
227 QV4::ScopedObject o(scope, QJSValuePrivate::convertedToValue(v4, siinfo->scriptApi(e)));-
228 if (!!o)
!!oDescription
TRUEevaluated 28 times by 1 test
Evaluated by:
  • tst_qqmlecmascript
FALSEnever evaluated
0-28
229 return o->get(name);
executed 28 times by 1 test: return o->get(name);
Executed by:
  • tst_qqmlecmascript
28
230 }
never executed: end of block
0
231-
232 // Fall through to base implementation-
233-
234 } else {
never executed: end of block
0
235-
236 if (name->startsWithUpper()) {
name->startsWithUpper()Description
TRUEevaluated 6166 times by 26 tests
Evaluated by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlcomponent
  • tst_qqmlconsole
  • tst_qqmlecmascript
  • tst_qqmlqt
  • tst_qqmlstatemachine
  • tst_qqmltypeloader
  • tst_qqmlvaluetypeproviders
  • tst_qqmlvaluetypes
  • tst_qqmlxmlhttprequest
  • tst_qquickanimatedimage
  • tst_qquickbehaviors
  • tst_qquickflipable
  • tst_qquickgridview
  • tst_qquickitem2
  • tst_qquicklayouts
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickmousearea
  • tst_qquickpathview
  • tst_qquickpositioners
  • tst_qquickrepeater
  • tst_qquickshadereffect
  • tst_qquicktextinput
  • ...
FALSEevaluated 141636 times by 19 tests
Evaluated by:
  • tst_examples
  • tst_qqmlecmascript
  • tst_qqmltypeloader
  • tst_qquickaccessible
  • tst_qquickanimations
  • tst_qquickdrag
  • tst_qquickdroparea
  • tst_qquickgraphicsinfo
  • tst_qquickgridview
  • tst_qquickitem2
  • tst_qquicklayouts
  • tst_qquicklistview
  • tst_qquickopenglinfo
  • tst_qquickpathview
  • tst_qquickpositioners
  • tst_qquickrepeater
  • tst_qquickscreen
  • tst_qquickvisualdatamodel
  • tst_scenegraph
6166-141636
237 bool ok = false;-
238 int value = type.enumValue(QQmlEnginePrivate::get(v4->qmlEngine()), name, &ok);-
239 if (ok)
okDescription
TRUEevaluated 6158 times by 26 tests
Evaluated by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlcomponent
  • tst_qqmlconsole
  • tst_qqmlecmascript
  • tst_qqmlqt
  • tst_qqmlstatemachine
  • tst_qqmltypeloader
  • tst_qqmlvaluetypeproviders
  • tst_qqmlvaluetypes
  • tst_qqmlxmlhttprequest
  • tst_qquickanimatedimage
  • tst_qquickbehaviors
  • tst_qquickflipable
  • tst_qquickgridview
  • tst_qquickitem2
  • tst_qquicklayouts
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickmousearea
  • tst_qquickpathview
  • tst_qquickpositioners
  • tst_qquickrepeater
  • tst_qquickshadereffect
  • tst_qquicktextinput
  • ...
FALSEevaluated 8 times by 1 test
Evaluated by:
  • tst_qqmlecmascript
8-6158
240 return QV4::Primitive::fromInt32(value).asReturnedValue();
executed 6158 times by 26 tests: return QV4::Primitive::fromInt32(value).asReturnedValue();
Executed by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlcomponent
  • tst_qqmlconsole
  • tst_qqmlecmascript
  • tst_qqmlqt
  • tst_qqmlstatemachine
  • tst_qqmltypeloader
  • tst_qqmlvaluetypeproviders
  • tst_qqmlvaluetypes
  • tst_qqmlxmlhttprequest
  • tst_qquickanimatedimage
  • tst_qquickbehaviors
  • tst_qquickflipable
  • tst_qquickgridview
  • tst_qquickitem2
  • tst_qquicklayouts
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickmousearea
  • tst_qquickpathview
  • tst_qquickpositioners
  • tst_qquickrepeater
  • tst_qquickshadereffect
  • tst_qquicktextinput
  • ...
6158
241-
242 value = type.scopedEnumIndex(QQmlEnginePrivate::get(v4->qmlEngine()), name, &ok);-
243 if (ok) {
okDescription
TRUEnever evaluated
FALSEevaluated 8 times by 1 test
Evaluated by:
  • tst_qqmlecmascript
0-8
244 Scoped<QQmlScopedEnumWrapper> enumWrapper(scope, v4->memoryManager->allocate<QQmlScopedEnumWrapper>());-
245 enumWrapper->d()->typePrivate = type.priv();-
246 QQmlType::refHandle(enumWrapper->d()->typePrivate);-
247 enumWrapper->d()->scopeEnumIndex = value;-
248 return enumWrapper.asReturnedValue();
never executed: return enumWrapper.asReturnedValue();
0
249 }-
250-
251 // Fall through to base implementation-
252-
253 } else if (w->d()->object) {
executed 8 times by 1 test: end of block
Executed by:
  • tst_qqmlecmascript
w->d()->objectDescription
TRUEevaluated 141634 times by 19 tests
Evaluated by:
  • tst_examples
  • tst_qqmlecmascript
  • tst_qqmltypeloader
  • tst_qquickaccessible
  • tst_qquickanimations
  • tst_qquickdrag
  • tst_qquickdroparea
  • tst_qquickgraphicsinfo
  • tst_qquickgridview
  • tst_qquickitem2
  • tst_qquicklayouts
  • tst_qquicklistview
  • tst_qquickopenglinfo
  • tst_qquickpathview
  • tst_qquickpositioners
  • tst_qquickrepeater
  • tst_qquickscreen
  • tst_qquickvisualdatamodel
  • tst_scenegraph
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qqmlecmascript
2-141634
254 QObject *ao = qmlAttachedPropertiesObjectById(type.attachedPropertiesId(QQmlEnginePrivate::get(v4->qmlEngine())), object);-
255 if (ao)
aoDescription
TRUEevaluated 141626 times by 19 tests
Evaluated by:
  • tst_examples
  • tst_qqmlecmascript
  • tst_qqmltypeloader
  • tst_qquickaccessible
  • tst_qquickanimations
  • tst_qquickdrag
  • tst_qquickdroparea
  • tst_qquickgraphicsinfo
  • tst_qquickgridview
  • tst_qquickitem2
  • tst_qquicklayouts
  • tst_qquicklistview
  • tst_qquickopenglinfo
  • tst_qquickpathview
  • tst_qquickpositioners
  • tst_qquickrepeater
  • tst_qquickscreen
  • tst_qquickvisualdatamodel
  • tst_scenegraph
FALSEevaluated 8 times by 1 test
Evaluated by:
  • tst_qqmlecmascript
8-141626
256 return QV4::QObjectWrapper::getQmlProperty(v4, context, ao, name, QV4::QObjectWrapper::IgnoreRevision, hasProperty);
executed 141626 times by 19 tests: return QV4::QObjectWrapper::getQmlProperty(v4, context, ao, name, QV4::QObjectWrapper::IgnoreRevision, hasProperty);
Executed by:
  • tst_examples
  • tst_qqmlecmascript
  • tst_qqmltypeloader
  • tst_qquickaccessible
  • tst_qquickanimations
  • tst_qquickdrag
  • tst_qquickdroparea
  • tst_qquickgraphicsinfo
  • tst_qquickgridview
  • tst_qquickitem2
  • tst_qquicklayouts
  • tst_qquicklistview
  • tst_qquickopenglinfo
  • tst_qquickpathview
  • tst_qquickpositioners
  • tst_qquickrepeater
  • tst_qquickscreen
  • tst_qquickvisualdatamodel
  • tst_scenegraph
141626
257-
258 // Fall through to base implementation-
259 }
executed 8 times by 1 test: end of block
Executed by:
  • tst_qqmlecmascript
8
260-
261 // Fall through to base implementation-
262 }
executed 18 times by 1 test: end of block
Executed by:
  • tst_qqmlecmascript
18
263-
264 // Fall through to base implementation-
265-
266 } else if (w->d()->typeNamespace) {
w->d()->typeNamespaceDescription
TRUEevaluated 324 times by 5 tests
Evaluated by:
  • tst_qqmlconnections
  • tst_qqmlecmascript
  • tst_qqmlsqldatabase
  • tst_qqmlvaluetypes
  • tst_qquickscreen
FALSEnever evaluated
0-324
267 Q_ASSERT(w->d()->importNamespace);-
268 QQmlTypeNameCache::Result r = w->d()->typeNamespace->query(name, w->d()->importNamespace);-
269-
270 if (r.isValid()) {
r.isValid()Description
TRUEevaluated 322 times by 5 tests
Evaluated by:
  • tst_qqmlconnections
  • tst_qqmlecmascript
  • tst_qqmlsqldatabase
  • tst_qqmlvaluetypes
  • tst_qquickscreen
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qqmlecmascript
2-322
271 if (r.type.isValid()) {
r.type.isValid()Description
TRUEevaluated 314 times by 5 tests
Evaluated by:
  • tst_qqmlconnections
  • tst_qqmlecmascript
  • tst_qqmlsqldatabase
  • tst_qqmlvaluetypes
  • tst_qquickscreen
FALSEevaluated 8 times by 1 test
Evaluated by:
  • tst_qqmlecmascript
8-314
272 return create(scope.engine, object, r.type, w->d()->mode);
executed 314 times by 5 tests: return create(scope.engine, object, r.type, w->d()->mode);
Executed by:
  • tst_qqmlconnections
  • tst_qqmlecmascript
  • tst_qqmlsqldatabase
  • tst_qqmlvaluetypes
  • tst_qquickscreen
314
273 } else if (r.scriptIndex != -1) {
r.scriptIndex != -1Description
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_qqmlecmascript
FALSEnever evaluated
0-8
274 QV4::ScopedObject scripts(scope, context->importedScripts.valueRef());-
275 return scripts->get(r.scriptIndex);
executed 8 times by 1 test: return scripts->get(r.scriptIndex);
Executed by:
  • tst_qqmlecmascript
8
276 } else if (r.importNamespace) {
r.importNamespaceDescription
TRUEnever evaluated
FALSEnever evaluated
0
277 return create(scope.engine, object, context->imports, r.importNamespace);
never executed: return create(scope.engine, object, context->imports, r.importNamespace);
0
278 }-
279-
280 return QV4::Encode::undefined();
never executed: return QV4::Encode::undefined();
0
281-
282 }-
283-
284 // Fall through to base implementation-
285-
286 } else {
executed 2 times by 1 test: end of block
Executed by:
  • tst_qqmlecmascript
2
287 Q_ASSERT(!"Unreachable");-
288 }
never executed: end of block
0
289-
290 bool ok = false;-
291 const ReturnedValue result = Object::virtualGet(m, id, receiver, &ok);-
292 if (hasProperty)
hasPropertyDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qqmlecmascript
FALSEevaluated 18 times by 1 test
Evaluated by:
  • tst_qqmlecmascript
2-18
293 *hasProperty = ok;
executed 2 times by 1 test: *hasProperty = ok;
Executed by:
  • tst_qqmlecmascript
2
294-
295 // Warn when attempting to access a lowercased enum value, non-singleton case-
296 if (!ok && type.isValid() && !type.isSingleton() && !name->startsWithUpper()) {
!okDescription
TRUEevaluated 16 times by 1 test
Evaluated by:
  • tst_qqmlecmascript
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qqmlecmascript
type.isValid()Description
TRUEevaluated 14 times by 1 test
Evaluated by:
  • tst_qqmlecmascript
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qqmlecmascript
!type.isSingleton()Description
TRUEevaluated 14 times by 1 test
Evaluated by:
  • tst_qqmlecmascript
FALSEnever evaluated
!name->startsWithUpper()Description
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_qqmlecmascript
FALSEevaluated 8 times by 1 test
Evaluated by:
  • tst_qqmlecmascript
0-16
297 bool enumOk = false;-
298 type.enumValue(QQmlEnginePrivate::get(v4->qmlEngine()), name, &enumOk);-
299 if (enumOk)
enumOkDescription
TRUEnever evaluated
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_qqmlecmascript
0-6
300 return throwLowercaseEnumError(v4, name, type);
never executed: return throwLowercaseEnumError(v4, name, type);
0
301 }
executed 6 times by 1 test: end of block
Executed by:
  • tst_qqmlecmascript
6
302-
303 return result;
executed 20 times by 1 test: return result;
Executed by:
  • tst_qqmlecmascript
20
304}-
305-
306-
307bool QQmlTypeWrapper::virtualPut(Managed *m, PropertyKey id, const Value &value, Value *receiver)-
308{-
309 if (!id.isString())
!id.isString()Description
TRUEnever evaluated
FALSEevaluated 1184 times by 9 tests
Evaluated by:
  • tst_qqmlconnections
  • tst_qqmlecmascript
  • tst_qquickanimationcontroller
  • tst_qquickdrag
  • tst_qquickdroparea
  • tst_qquicklayouts
  • tst_qquickvisualdatamodel
  • tst_quicktestmainwithsetup
  • tst_testfiltering
0-1184
310 return Object::virtualPut(m, id, value, receiver);
never executed: return Object::virtualPut(m, id, value, receiver);
0
311-
312-
313 Q_ASSERT(m->as<QQmlTypeWrapper>());-
314 QQmlTypeWrapper *w = static_cast<QQmlTypeWrapper *>(m);-
315 QV4::Scope scope(w);-
316 if (scope.engine->hasException)
scope.engine->hasExceptionDescription
TRUEnever evaluated
FALSEevaluated 1184 times by 9 tests
Evaluated by:
  • tst_qqmlconnections
  • tst_qqmlecmascript
  • tst_qquickanimationcontroller
  • tst_qquickdrag
  • tst_qquickdroparea
  • tst_qquicklayouts
  • tst_qquickvisualdatamodel
  • tst_quicktestmainwithsetup
  • tst_testfiltering
0-1184
317 return false;
never executed: return false;
0
318-
319 ScopedString name(scope, id.asStringOrSymbol());-
320 QQmlContextData *context = scope.engine->callingQmlContext();-
321-
322 QQmlType type = w->d()->type();-
323 if (type.isValid() && !type.isSingleton() && w->d()->object) {
type.isValid()Description
TRUEevaluated 1184 times by 9 tests
Evaluated by:
  • tst_qqmlconnections
  • tst_qqmlecmascript
  • tst_qquickanimationcontroller
  • tst_qquickdrag
  • tst_qquickdroparea
  • tst_qquicklayouts
  • tst_qquickvisualdatamodel
  • tst_quicktestmainwithsetup
  • tst_testfiltering
FALSEnever evaluated
!type.isSingleton()Description
TRUEevaluated 1112 times by 5 tests
Evaluated by:
  • tst_qqmlecmascript
  • tst_qquickdrag
  • tst_qquickdroparea
  • tst_qquicklayouts
  • tst_qquickvisualdatamodel
FALSEevaluated 72 times by 6 tests
Evaluated by:
  • tst_qqmlconnections
  • tst_qqmlecmascript
  • tst_qquickanimationcontroller
  • tst_qquicklayouts
  • tst_quicktestmainwithsetup
  • tst_testfiltering
0-1184
324 QObject *object = w->d()->object;-
325 QQmlEngine *e = scope.engine->qmlEngine();-
326 QObject *ao = qmlAttachedPropertiesObjectById(type.attachedPropertiesId(QQmlEnginePrivate::get(e)), object);-
327 if (ao)
aoDescription
TRUEevaluated 1112 times by 5 tests
Evaluated by:
  • tst_qqmlecmascript
  • tst_qquickdrag
  • tst_qquickdroparea
  • tst_qquicklayouts
  • tst_qquickvisualdatamodel
FALSEnever evaluated
0-1112
328 return QV4::QObjectWrapper::setQmlProperty(scope.engine, context, ao, name, QV4::QObjectWrapper::IgnoreRevision, value);
executed 1112 times by 5 tests: return QV4::QObjectWrapper::setQmlProperty(scope.engine, context, ao, name, QV4::QObjectWrapper::IgnoreRevision, value);
Executed by:
  • tst_qqmlecmascript
  • tst_qquickdrag
  • tst_qquickdroparea
  • tst_qquicklayouts
  • tst_qquickvisualdatamodel
1112
329 return false;
never executed: return false;
0
330 } else if (type.isSingleton()) {
type.isSingleton()Description
TRUEevaluated 72 times by 6 tests
Evaluated by:
  • tst_qqmlconnections
  • tst_qqmlecmascript
  • tst_qquickanimationcontroller
  • tst_qquicklayouts
  • tst_quicktestmainwithsetup
  • tst_testfiltering
FALSEnever evaluated
0-72
331 QQmlEngine *e = scope.engine->qmlEngine();-
332 QQmlType::SingletonInstanceInfo *siinfo = type.singletonInstanceInfo();-
333 siinfo->init(e);-
334-
335 QObject *qobjectSingleton = siinfo->qobjectApi(e);-
336 if (qobjectSingleton) {
qobjectSingletonDescription
TRUEevaluated 68 times by 6 tests
Evaluated by:
  • tst_qqmlconnections
  • tst_qqmlecmascript
  • tst_qquickanimationcontroller
  • tst_qquicklayouts
  • tst_quicktestmainwithsetup
  • tst_testfiltering
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qqmlecmascript
4-68
337 return QV4::QObjectWrapper::setQmlProperty(scope.engine, context, qobjectSingleton, name, QV4::QObjectWrapper::IgnoreRevision, value);
executed 68 times by 6 tests: return QV4::QObjectWrapper::setQmlProperty(scope.engine, context, qobjectSingleton, name, QV4::QObjectWrapper::IgnoreRevision, value);
Executed by:
  • tst_qqmlconnections
  • tst_qqmlecmascript
  • tst_qquickanimationcontroller
  • tst_qquicklayouts
  • tst_quicktestmainwithsetup
  • tst_testfiltering
68
338 } else if (!siinfo->scriptApi(e).isUndefined()) {
!siinfo->scrip....isUndefined()Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qqmlecmascript
FALSEnever evaluated
0-4
339 QV4::ScopedObject apiprivate(scope, QJSValuePrivate::convertedToValue(scope.engine, siinfo->scriptApi(e)));-
340 if (!apiprivate) {
!apiprivateDescription
TRUEnever evaluated
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qqmlecmascript
0-4
341 QString error = QLatin1String("Cannot assign to read-only property \"") + name->toQString() + QLatin1Char('\"');-
342 scope.engine->throwError(error);-
343 return false;
never executed: return false;
0
344 } else {-
345 return apiprivate->put(name, value);
executed 4 times by 1 test: return apiprivate->put(name, value);
Executed by:
  • tst_qqmlecmascript
4
346 }-
347 }-
348 }
never executed: end of block
0
349-
350 return false;
never executed: return false;
0
351}-
352-
353PropertyAttributes QQmlTypeWrapper::virtualGetOwnProperty(Managed *m, PropertyKey id, Property *p)-
354{-
355 if (id.isString()) {
id.isString()Description
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_qqmlecmascript
FALSEnever evaluated
0-6
356 Scope scope(m);-
357 ScopedString n(scope, id.asStringOrSymbol());-
358 // ### Implement more efficiently.-
359 bool hasProperty = false;-
360 static_cast<Object *>(m)->get(n, &hasProperty);-
361 return hasProperty ? Attr_Data : Attr_Invalid;
executed 6 times by 1 test: return hasProperty ? Attr_Data : Attr_Invalid;
Executed by:
  • tst_qqmlecmascript
6
362 }-
363-
364 return QV4::Object::virtualGetOwnProperty(m, id, p);
never executed: return QV4::Object::virtualGetOwnProperty(m, id, p);
0
365}-
366-
367bool QQmlTypeWrapper::virtualIsEqualTo(Managed *a, Managed *b)-
368{-
369 Q_ASSERT(a->as<QV4::QQmlTypeWrapper>());-
370 QV4::QQmlTypeWrapper *qmlTypeWrapperA = static_cast<QV4::QQmlTypeWrapper *>(a);-
371 if (QV4::QQmlTypeWrapper *qmlTypeWrapperB = b->as<QV4::QQmlTypeWrapper>())
QV4::QQmlTypeW...TypeWrapper>()Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qqmlecmascript
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_qqmlecmascript
2-6
372 return qmlTypeWrapperA->toVariant() == qmlTypeWrapperB->toVariant();
executed 2 times by 1 test: return qmlTypeWrapperA->toVariant() == qmlTypeWrapperB->toVariant();
Executed by:
  • tst_qqmlecmascript
2
373 else if (QV4::QObjectWrapper *qobjectWrapper = b->as<QV4::QObjectWrapper>())
QV4::QObjectWr...jectWrapper>()Description
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_qqmlecmascript
FALSEnever evaluated
0-6
374 return qmlTypeWrapperA->toVariant().value<QObject*>() == qobjectWrapper->object();
executed 6 times by 1 test: return qmlTypeWrapperA->toVariant().value<QObject*>() == qobjectWrapper->object();
Executed by:
  • tst_qqmlecmascript
6
375-
376 return false;
never executed: return false;
0
377}-
378-
379ReturnedValue QQmlTypeWrapper::virtualInstanceOf(const Object *typeObject, const Value &var)-
380{-
381 Q_ASSERT(typeObject->as<QV4::QQmlTypeWrapper>());-
382 const QV4::QQmlTypeWrapper *typeWrapper = static_cast<const QV4::QQmlTypeWrapper *>(typeObject);-
383 QV4::ExecutionEngine *engine = typeObject->internalClass()->engine;-
384 QQmlEnginePrivate *qenginepriv = QQmlEnginePrivate::get(engine->qmlEngine());-
385-
386 // can only compare a QObject* against a QML type-
387 const QObjectWrapper *wrapper = var.as<QObjectWrapper>();-
388 if (!wrapper)
!wrapperDescription
TRUEnever evaluated
FALSEevaluated 56 times by 1 test
Evaluated by:
  • tst_qquicklayouts
0-56
389 return engine->throwTypeError();
never executed: return engine->throwTypeError();
0
390-
391 // in case the wrapper outlived the QObject*-
392 const QObject *wrapperObject = wrapper->object();-
393 if (!wrapperObject)
!wrapperObjectDescription
TRUEnever evaluated
FALSEevaluated 56 times by 1 test
Evaluated by:
  • tst_qquicklayouts
0-56
394 return engine->throwTypeError();
never executed: return engine->throwTypeError();
0
395-
396 const int myTypeId = typeWrapper->d()->type().typeId();-
397 QQmlMetaObject myQmlType;-
398 if (myTypeId == 0) {
myTypeId == 0Description
TRUEnever evaluated
FALSEevaluated 56 times by 1 test
Evaluated by:
  • tst_qquicklayouts
0-56
399 // we're a composite type; a composite type cannot be equal to a-
400 // non-composite object instance (Rectangle{} is never an instance of-
401 // CustomRectangle)-
402 QQmlData *theirDData = QQmlData::get(wrapperObject, /*create=*/false);-
403 Q_ASSERT(theirDData); // must exist, otherwise how do we have a QObjectWrapper for it?!-
404 if (!theirDData->compilationUnit)
!theirDData->compilationUnitDescription
TRUEnever evaluated
FALSEnever evaluated
0
405 return Encode(false);
never executed: return Encode(false);
0
406-
407 QQmlRefPointer<QQmlTypeData> td = qenginepriv->typeLoader.getType(typeWrapper->d()->type().sourceUrl());-
408 CompiledData::CompilationUnit *cu = td->compilationUnit();-
409 myQmlType = qenginepriv->metaObjectForType(cu->metaTypeId);-
410 } else {
never executed: end of block
0
411 myQmlType = qenginepriv->metaObjectForType(myTypeId);-
412 }
executed 56 times by 1 test: end of block
Executed by:
  • tst_qquicklayouts
56
413-
414 const QMetaObject *theirType = wrapperObject->metaObject();-
415-
416 return QV4::Encode(QQmlMetaObject::canConvert(theirType, myQmlType));
executed 56 times by 1 test: return QV4::Encode(QQmlMetaObject::canConvert(theirType, myQmlType));
Executed by:
  • tst_qquicklayouts
56
417}-
418-
419void Heap::QQmlScopedEnumWrapper::destroy()-
420{-
421 QQmlType::derefHandle(typePrivate);-
422 typePrivate = nullptr;-
423 Object::destroy();-
424}
never executed: end of block
0
425-
426QQmlType Heap::QQmlScopedEnumWrapper::type() const-
427{-
428 return QQmlType(typePrivate);
never executed: return QQmlType(typePrivate);
0
429}-
430-
431ReturnedValue QQmlScopedEnumWrapper::virtualGet(const Managed *m, PropertyKey id, const Value *receiver, bool *hasProperty)-
432{-
433 Q_ASSERT(m->as<QQmlScopedEnumWrapper>());-
434 if (!id.isString())
!id.isString()Description
TRUEnever evaluated
FALSEnever evaluated
0
435 return Object::virtualGet(m, id, receiver, hasProperty);
never executed: return Object::virtualGet(m, id, receiver, hasProperty);
0
436-
437 const QQmlScopedEnumWrapper *resource = static_cast<const QQmlScopedEnumWrapper *>(m);-
438 QV4::ExecutionEngine *v4 = resource->engine();-
439 QV4::Scope scope(v4);-
440 ScopedString name(scope, id.asStringOrSymbol());-
441-
442 QQmlType type = resource->d()->type();-
443 int index = resource->d()->scopeEnumIndex;-
444-
445 bool ok = false;-
446 int value = type.scopedEnumValue(QQmlEnginePrivate::get(v4->qmlEngine()), index, name, &ok);-
447 if (hasProperty)
hasPropertyDescription
TRUEnever evaluated
FALSEnever evaluated
0
448 *hasProperty = ok;
never executed: *hasProperty = ok;
0
449 if (ok)
okDescription
TRUEnever evaluated
FALSEnever evaluated
0
450 return QV4::Primitive::fromInt32(value).asReturnedValue();
never executed: return QV4::Primitive::fromInt32(value).asReturnedValue();
0
451-
452 return Encode::undefined();
never executed: return Encode::undefined();
0
453}-
454-
455QT_END_NAMESPACE-
Source codeSwitch to Preprocessed file

Generated by Squish Coco 4.2.0