OpenCoverage

qjsvalue_p.h

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/qml/jsapi/qjsvalue_p.h
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4class QJSValuePrivate-
5{-
6public:-
7 static inline QV4::Value *getValue(const QJSValue *jsval)-
8 {-
9 if (jsval->d & 3
jsval->d & 3Description
TRUEevaluated 296 times by 4 tests
Evaluated by:
  • tst_qjsengine
  • tst_qjsvalue
  • tst_qjsvalueiterator
  • tst_qqmlecmascript
FALSEevaluated 2436 times by 18 tests
Evaluated by:
  • tst_examples
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qjsvalue
  • tst_qjsvalueiterator
  • tst_qqmlecmascript
  • tst_qqmlenginedebugservice
  • tst_qqmlstatemachine
  • tst_qqmlvaluetypes
  • tst_qquickanimationcontroller
  • tst_qquickgridview
  • tst_qquicklayouts
  • tst_qquicklistview
  • tst_qquickscreen
  • tst_qquicktext
  • tst_qquickworkerscript
  • tst_quicktestmainwithsetup
  • tst_testfiltering
)
296-2436
10 return
executed 296 times by 4 tests: return nullptr;
Executed by:
  • tst_qjsengine
  • tst_qjsvalue
  • tst_qjsvalueiterator
  • tst_qqmlecmascript
nullptr;
executed 296 times by 4 tests: return nullptr;
Executed by:
  • tst_qjsengine
  • tst_qjsvalue
  • tst_qjsvalueiterator
  • tst_qqmlecmascript
296
11 return
executed 2436 times by 18 tests: return reinterpret_cast<QV4::Value *>(jsval->d);
Executed by:
  • tst_examples
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qjsvalue
  • tst_qjsvalueiterator
  • tst_qqmlecmascript
  • tst_qqmlenginedebugservice
  • tst_qqmlstatemachine
  • tst_qqmlvaluetypes
  • tst_qquickanimationcontroller
  • tst_qquickgridview
  • tst_qquicklayouts
  • tst_qquicklistview
  • tst_qquickscreen
  • tst_qquicktext
  • tst_qquickworkerscript
  • tst_quicktestmainwithsetup
  • tst_testfiltering
reinterpret_cast<QV4::Value *>(jsval->d);
executed 2436 times by 18 tests: return reinterpret_cast<QV4::Value *>(jsval->d);
Executed by:
  • tst_examples
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qjsvalue
  • tst_qjsvalueiterator
  • tst_qqmlecmascript
  • tst_qqmlenginedebugservice
  • tst_qqmlstatemachine
  • tst_qqmlvaluetypes
  • tst_qquickanimationcontroller
  • tst_qquickgridview
  • tst_qquicklayouts
  • tst_qquicklistview
  • tst_qquickscreen
  • tst_qquicktext
  • tst_qquickworkerscript
  • tst_quicktestmainwithsetup
  • tst_testfiltering
2436
12 }-
13-
14 static inline QVariant *getVariant(const QJSValue *jsval)-
15 {-
16 if (jsval->d & 1
jsval->d & 1Description
TRUEevaluated 194 times by 3 tests
Evaluated by:
  • tst_qjsengine
  • tst_qjsvalue
  • tst_qqmlecmascript
FALSEevaluated 16 times by 1 test
Evaluated by:
  • tst_qjsvalue
)
16-194
17 return
executed 194 times by 3 tests: return reinterpret_cast<QVariant *>(jsval->d & ~3);
Executed by:
  • tst_qjsengine
  • tst_qjsvalue
  • tst_qqmlecmascript
reinterpret_cast<QVariant *>(jsval->d & ~3);
executed 194 times by 3 tests: return reinterpret_cast<QVariant *>(jsval->d & ~3);
Executed by:
  • tst_qjsengine
  • tst_qjsvalue
  • tst_qqmlecmascript
194
18 return
executed 16 times by 1 test: return nullptr;
Executed by:
  • tst_qjsvalue
nullptr;
executed 16 times by 1 test: return nullptr;
Executed by:
  • tst_qjsvalue
16
19 }-
20-
21 static inline void setVariant(QJSValue *jsval, const QVariant &v) {-
22 QVariant *val = new QVariant(v);-
23 jsval->d = reinterpret_cast<quintptr>(val) | 1;-
24 }
executed 16 times by 1 test: end of block
Executed by:
  • tst_qjsvalue
16
25-
26 static inline void setValue(QJSValue *jsval, QV4::ExecutionEngine *engine, const QV4::Value &v) {-
27 QV4::Value *value = engine->memoryManager->m_persistentValues->allocate();-
28 *value = v;-
29 jsval->d = reinterpret_cast<quintptr>(value);-
30 }
never executed: end of block
0
31-
32 static inline void setValue(QJSValue *jsval, QV4::ExecutionEngine *engine, QV4::ReturnedValue v) {-
33 QV4::Value *value = engine->memoryManager->m_persistentValues->allocate();-
34 *value = v;-
35 jsval->d = reinterpret_cast<quintptr>(value);-
36 }
never executed: end of block
0
37-
38 static QV4::ReturnedValue convertedToValue(QV4::ExecutionEngine *e, const QJSValue &jsval)-
39 {-
40 QV4::Value *v = getValue(&jsval);-
41 if (!v
!vDescription
TRUEevaluated 14 times by 2 tests
Evaluated by:
  • tst_qjsengine
  • tst_qqmlecmascript
FALSEevaluated 700 times by 15 tests
Evaluated by:
  • tst_examples
  • tst_qjsengine
  • tst_qqmlecmascript
  • tst_qqmlenginedebugservice
  • tst_qqmlstatemachine
  • tst_qqmlvaluetypes
  • tst_qquickanimationcontroller
  • tst_qquickgridview
  • tst_qquicklayouts
  • tst_qquicklistview
  • tst_qquickscreen
  • tst_qquicktext
  • tst_qquickworkerscript
  • tst_quicktestmainwithsetup
  • tst_testfiltering
) {
14-700
42 QVariant *variant = getVariant(&jsval);-
43 v = e->memoryManager->m_persistentValues->allocate();-
44 *v = variant
variantDescription
TRUEevaluated 14 times by 2 tests
Evaluated by:
  • tst_qjsengine
  • tst_qqmlecmascript
FALSEnever evaluated
? e->fromVariant(*variant) : QV4::Encode::undefined();
0-14
45 jsval.d = reinterpret_cast<quintptr>(v);-
46 delete variant;-
47 }
executed 14 times by 2 tests: end of block
Executed by:
  • tst_qjsengine
  • tst_qqmlecmascript
14
48-
49 if (QV4::PersistentValueStorage::getEngine(v) != e
QV4::Persisten...Engine(v) != eDescription
TRUEevaluated 14 times by 1 test
Evaluated by:
  • tst_qqmlecmascript
FALSEevaluated 700 times by 15 tests
Evaluated by:
  • tst_examples
  • tst_qjsengine
  • tst_qqmlecmascript
  • tst_qqmlenginedebugservice
  • tst_qqmlstatemachine
  • tst_qqmlvaluetypes
  • tst_qquickanimationcontroller
  • tst_qquickgridview
  • tst_qquicklayouts
  • tst_qquicklistview
  • tst_qquickscreen
  • tst_qquicktext
  • tst_qquickworkerscript
  • tst_quicktestmainwithsetup
  • tst_testfiltering
) {
14-700
50 QMessageLogger(__FILE__, 111, __PRETTY_FUNCTION__).warning("JSValue can't be reassigned to another engine.");-
51 return
executed 14 times by 1 test: return QV4::Encode::undefined();
Executed by:
  • tst_qqmlecmascript
QV4::Encode::undefined();
executed 14 times by 1 test: return QV4::Encode::undefined();
Executed by:
  • tst_qqmlecmascript
14
52 }-
53-
54 return
executed 700 times by 15 tests: return v->asReturnedValue();
Executed by:
  • tst_examples
  • tst_qjsengine
  • tst_qqmlecmascript
  • tst_qqmlenginedebugservice
  • tst_qqmlstatemachine
  • tst_qqmlvaluetypes
  • tst_qquickanimationcontroller
  • tst_qquickgridview
  • tst_qquicklayouts
  • tst_qquicklistview
  • tst_qquickscreen
  • tst_qquicktext
  • tst_qquickworkerscript
  • tst_quicktestmainwithsetup
  • tst_testfiltering
v->asReturnedValue();
executed 700 times by 15 tests: return v->asReturnedValue();
Executed by:
  • tst_examples
  • tst_qjsengine
  • tst_qqmlecmascript
  • tst_qqmlenginedebugservice
  • tst_qqmlstatemachine
  • tst_qqmlvaluetypes
  • tst_qquickanimationcontroller
  • tst_qquickgridview
  • tst_qquicklayouts
  • tst_qquicklistview
  • tst_qquickscreen
  • tst_qquicktext
  • tst_qquickworkerscript
  • tst_quicktestmainwithsetup
  • tst_testfiltering
700
55 }-
56-
57 static QV4::Value *valueForData(const QJSValue *jsval, QV4::Value *scratch)-
58 {-
59 QV4::Value *v = getValue(jsval);-
60 if (v
vDescription
TRUEevaluated 330 times by 4 tests
Evaluated by:
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qjsvalue
  • tst_qqmlvaluetypes
FALSEevaluated 152 times by 2 tests
Evaluated by:
  • tst_qjsengine
  • tst_qjsvalue
)
152-330
61 return
executed 330 times by 4 tests: return v;
Executed by:
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qjsvalue
  • tst_qqmlvaluetypes
v;
executed 330 times by 4 tests: return v;
Executed by:
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qjsvalue
  • tst_qqmlvaluetypes
330
62 v = scratch;-
63 QVariant *variant = getVariant(jsval);-
64 if (!variant
!variantDescription
TRUEevaluated 16 times by 1 test
Evaluated by:
  • tst_qjsvalue
FALSEevaluated 136 times by 2 tests
Evaluated by:
  • tst_qjsengine
  • tst_qjsvalue
) {
16-136
65 *v = QV4::Encode::undefined();-
66 return
executed 16 times by 1 test: return v;
Executed by:
  • tst_qjsvalue
v;
executed 16 times by 1 test: return v;
Executed by:
  • tst_qjsvalue
16
67 }-
68-
69 switch (variant->userType()) {-
70 case
never executed: case QMetaType::UnknownType:
QMetaType::UnknownType:
never executed: case QMetaType::UnknownType:
0
71 case
never executed: case QMetaType::Void:
QMetaType::Void:
never executed: case QMetaType::Void:
0
72 *v = QV4::Encode::undefined();-
73 break;
never executed: break;
0
74 case
executed 2 times by 1 test: case QMetaType::Nullptr:
Executed by:
  • tst_qjsvalue
QMetaType::Nullptr:
executed 2 times by 1 test: case QMetaType::Nullptr:
Executed by:
  • tst_qjsvalue
2
75 case
never executed: case QMetaType::VoidStar:
QMetaType::VoidStar:
never executed: case QMetaType::VoidStar:
0
76 *v = QV4::Encode::null();-
77 break;
executed 2 times by 1 test: break;
Executed by:
  • tst_qjsvalue
2
78 case
executed 22 times by 1 test: case QMetaType::Bool:
Executed by:
  • tst_qjsvalue
QMetaType::Bool:
executed 22 times by 1 test: case QMetaType::Bool:
Executed by:
  • tst_qjsvalue
22
79 *v = QV4::Encode(variant->toBool());-
80 break;
executed 22 times by 1 test: break;
Executed by:
  • tst_qjsvalue
22
81 case
executed 46 times by 1 test: case QMetaType::Double:
Executed by:
  • tst_qjsvalue
QMetaType::Double:
executed 46 times by 1 test: case QMetaType::Double:
Executed by:
  • tst_qjsvalue
46
82 *v = QV4::Encode(variant->toDouble());-
83 break;
executed 46 times by 1 test: break;
Executed by:
  • tst_qjsvalue
46
84 case
executed 22 times by 2 tests: case QMetaType::Int:
Executed by:
  • tst_qjsengine
  • tst_qjsvalue
QMetaType::Int:
executed 22 times by 2 tests: case QMetaType::Int:
Executed by:
  • tst_qjsengine
  • tst_qjsvalue
22
85 case
never executed: case QMetaType::Short:
QMetaType::Short:
never executed: case QMetaType::Short:
0
86 case
never executed: case QMetaType::UShort:
QMetaType::UShort:
never executed: case QMetaType::UShort:
0
87 case
never executed: case QMetaType::Char:
QMetaType::Char:
never executed: case QMetaType::Char:
0
88 case
never executed: case QMetaType::UChar:
QMetaType::UChar:
never executed: case QMetaType::UChar:
0
89 *v = QV4::Encode(variant->toInt());-
90 break;
executed 22 times by 2 tests: break;
Executed by:
  • tst_qjsengine
  • tst_qjsvalue
22
91 case
never executed: case QMetaType::UInt:
QMetaType::UInt:
never executed: case QMetaType::UInt:
0
92 *v = QV4::Encode(variant->toUInt());-
93 break;
never executed: break;
0
94 default
executed 44 times by 1 test: default:
Executed by:
  • tst_qjsvalue
:
executed 44 times by 1 test: default:
Executed by:
  • tst_qjsvalue
44
95 return
executed 44 times by 1 test: return nullptr;
Executed by:
  • tst_qjsvalue
nullptr;
executed 44 times by 1 test: return nullptr;
Executed by:
  • tst_qjsvalue
44
96 }-
97 return
executed 92 times by 2 tests: return v;
Executed by:
  • tst_qjsengine
  • tst_qjsvalue
v;
executed 92 times by 2 tests: return v;
Executed by:
  • tst_qjsengine
  • tst_qjsvalue
92
98 }-
99-
100 static QV4::ExecutionEngine *engine(const QJSValue *jsval) {-
101 QV4::Value *v = getValue(jsval);-
102 return
executed 678 times by 5 tests: return v ? QV4::PersistentValueStorage::getEngine(v) : nullptr;
Executed by:
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qjsvalue
  • tst_qjsvalueiterator
  • tst_qqmlvaluetypes
v ? QV4::PersistentValueStorage::getEngine(v) : nullptr;
executed 678 times by 5 tests: return v ? QV4::PersistentValueStorage::getEngine(v) : nullptr;
Executed by:
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qjsvalue
  • tst_qjsvalueiterator
  • tst_qqmlvaluetypes
678
103 }-
104-
105 static inline bool checkEngine(QV4::ExecutionEngine *e, const QJSValue &jsval) {-
106 QV4::ExecutionEngine *v4 = engine(&jsval);-
107 return
never executed: return !v4 || v4 == e;
!v4 || v4 == e;
never executed: return !v4 || v4 == e;
0
108 }-
109-
110 static inline void free(QJSValue *jsval) {-
111 if (QV4::Value *v = QJSValuePrivate::getValue(jsval)
QV4::Value *v ...etValue(jsval)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
112 QV4::PersistentValueStorage::free(v);
never executed: QV4::PersistentValueStorage::free(v);
0
113 else if (QVariant *v = QJSValuePrivate::getVariant(jsval)
QVariant *v = ...Variant(jsval)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
114 delete v;
never executed: delete v;
0
115 }
never executed: end of block
0
116};-
117-
118-
Switch to Source codePreprocessed file

Generated by Squish Coco 4.2.0