Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/qml/jsapi/qjsengine.cpp |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | - | |||||||||||||
2 | - | |||||||||||||
3 | - | |||||||||||||
4 | - | |||||||||||||
5 | - | |||||||||||||
6 | - | |||||||||||||
7 | - | |||||||||||||
8 | - | |||||||||||||
9 | - | |||||||||||||
10 | template <> struct QMetaTypeId< QList<int> > { enum { Defined = 1 }; static int qt_metatype_id() { static QBasicAtomicInt metatype_id = { 0 }; if (const int id = metatype_id.loadAcquire()) return id; const int newId = qRegisterMetaType< QList<int> >("QList<int>", reinterpret_cast< QList<int> *>(quintptr(-1))); metatype_id.storeRelease(newId); return newId; } }; | - | ||||||||||||
11 | - | |||||||||||||
12 | - | |||||||||||||
13 | static void checkForApplicationInstance() | - | ||||||||||||
14 | { | - | ||||||||||||
15 | if (!QCoreApplication::instance()
| 0-10338 | ||||||||||||
16 | QMessageLogger(__FILE__, 285, __PRETTY_FUNCTION__).fatal("QJSEngine: Must construct a QCoreApplication before a QJSEngine"); never executed: QMessageLogger(__FILE__, 285, __PRETTY_FUNCTION__).fatal("QJSEngine: Must construct a QCoreApplication before a QJSEngine"); | 0 | ||||||||||||
17 | } executed 10338 times by 151 tests: end of block Executed by:
| 10338 | ||||||||||||
18 | - | |||||||||||||
19 | - | |||||||||||||
20 | - | |||||||||||||
21 | - | |||||||||||||
22 | - | |||||||||||||
23 | - | |||||||||||||
24 | - | |||||||||||||
25 | QJSEngine::QJSEngine() | - | ||||||||||||
26 | : QJSEngine(nullptr) | - | ||||||||||||
27 | { | - | ||||||||||||
28 | } executed 2662 times by 8 tests: end of block Executed by:
| 2662 | ||||||||||||
29 | QJSEngine::QJSEngine(QObject *parent) | - | ||||||||||||
30 | : QObject(*new QJSEnginePrivate, parent) | - | ||||||||||||
31 | , m_v4Engine(new QV4::ExecutionEngine(this)) | - | ||||||||||||
32 | { | - | ||||||||||||
33 | m_v4Engine->v8Engine = new QV8Engine(m_v4Engine); | - | ||||||||||||
34 | checkForApplicationInstance(); | - | ||||||||||||
35 | - | |||||||||||||
36 | QJSEnginePrivate::addToDebugServer(this); | - | ||||||||||||
37 | } executed 2664 times by 8 tests: end of block Executed by:
| 2664 | ||||||||||||
38 | - | |||||||||||||
39 | - | |||||||||||||
40 | - | |||||||||||||
41 | - | |||||||||||||
42 | QJSEngine::QJSEngine(QJSEnginePrivate &dd, QObject *parent) | - | ||||||||||||
43 | : QObject(dd, parent) | - | ||||||||||||
44 | , m_v4Engine(new QV4::ExecutionEngine(this)) | - | ||||||||||||
45 | { | - | ||||||||||||
46 | m_v4Engine->v8Engine = new QV8Engine(m_v4Engine); | - | ||||||||||||
47 | checkForApplicationInstance(); | - | ||||||||||||
48 | } executed 7674 times by 148 tests: end of block Executed by:
| 7674 | ||||||||||||
49 | QJSEngine::~QJSEngine() | - | ||||||||||||
50 | { | - | ||||||||||||
51 | QJSEnginePrivate::removeFromDebugServer(this); | - | ||||||||||||
52 | delete m_v4Engine->v8Engine; | - | ||||||||||||
53 | delete m_v4Engine; | - | ||||||||||||
54 | } executed 10324 times by 151 tests: end of block Executed by:
| 10324 | ||||||||||||
55 | void QJSEngine::collectGarbage() | - | ||||||||||||
56 | { | - | ||||||||||||
57 | m_v4Engine->memoryManager->runGC(); | - | ||||||||||||
58 | } executed 280 times by 11 tests: end of block Executed by:
| 280 | ||||||||||||
59 | void QJSEngine::installTranslatorFunctions(const QJSValue &object) | - | ||||||||||||
60 | { | - | ||||||||||||
61 | installExtensions(TranslationExtension, object); | - | ||||||||||||
62 | } executed 142 times by 1 test: end of block Executed by:
| 142 | ||||||||||||
63 | void QJSEngine::installExtensions(QJSEngine::Extensions extensions, const QJSValue &object) | - | ||||||||||||
64 | { | - | ||||||||||||
65 | QV4::ExecutionEngine *otherEngine = QJSValuePrivate::engine(&object); | - | ||||||||||||
66 | if (otherEngine
| 0-164 | ||||||||||||
67 | QMessageLogger(__FILE__, 417, __PRETTY_FUNCTION__).warning("QJSEngine: Trying to install extensions from a different engine"); | - | ||||||||||||
68 | return; never executed: return; | 0 | ||||||||||||
69 | } | - | ||||||||||||
70 | - | |||||||||||||
71 | QV4::Scope scope(m_v4Engine); | - | ||||||||||||
72 | QV4::ScopedObject obj(scope); | - | ||||||||||||
73 | QV4::Value *val = QJSValuePrivate::getValue(&object); | - | ||||||||||||
74 | if (val
| 0-164 | ||||||||||||
75 | obj = val; never executed: obj = val; | 0 | ||||||||||||
76 | if (!obj
| 0-164 | ||||||||||||
77 | obj = scope.engine->globalObject; executed 164 times by 1 test: obj = scope.engine->globalObject; Executed by:
| 164 | ||||||||||||
78 | - | |||||||||||||
79 | QV4::GlobalExtensions::init(obj, extensions); | - | ||||||||||||
80 | } executed 164 times by 1 test: end of block Executed by:
| 164 | ||||||||||||
81 | QJSValue QJSEngine::evaluate(const QString& program, const QString& fileName, int lineNumber) | - | ||||||||||||
82 | { | - | ||||||||||||
83 | QV4::ExecutionEngine *v4 = m_v4Engine; | - | ||||||||||||
84 | QV4::Scope scope(v4); | - | ||||||||||||
85 | QV4::ScopedValue result(scope); | - | ||||||||||||
86 | - | |||||||||||||
87 | QV4::Script script(v4->rootContext(), QV4::Compiler::ContextType::Global, program, fileName, lineNumber); | - | ||||||||||||
88 | script.strictMode = false; | - | ||||||||||||
89 | if (v4->currentStackFrame
| 4-35746 | ||||||||||||
90 | script.strictMode = v4->currentStackFrame->v4Function->isStrict(); executed 4 times by 2 tests: script.strictMode = v4->currentStackFrame->v4Function->isStrict(); Executed by:
| 4 | ||||||||||||
91 | else if (v4->globalCode
| 0-35746 | ||||||||||||
92 | script.strictMode = v4->globalCode->isStrict(); never executed: script.strictMode = v4->globalCode->isStrict(); | 0 | ||||||||||||
93 | script.inheritContext = true; | - | ||||||||||||
94 | script.parse(); | - | ||||||||||||
95 | if (!scope.engine->hasException
| 270-35480 | ||||||||||||
96 | result = script.run(); executed 35480 times by 8 tests: result = script.run(); Executed by:
| 35480 | ||||||||||||
97 | if (scope.engine->hasException
| 412-35338 | ||||||||||||
98 | result = v4->catchException(); executed 412 times by 5 tests: result = v4->catchException(); Executed by:
| 412 | ||||||||||||
99 | - | |||||||||||||
100 | QJSValue retval(v4, result->asReturnedValue()); | - | ||||||||||||
101 | - | |||||||||||||
102 | return executed 35750 times by 8 tests: retval;return retval; Executed by:
executed 35750 times by 8 tests: return retval; Executed by:
| 35750 | ||||||||||||
103 | } | - | ||||||||||||
104 | QJSValue QJSEngine::newObject() | - | ||||||||||||
105 | { | - | ||||||||||||
106 | QV4::Scope scope(m_v4Engine); | - | ||||||||||||
107 | QV4::ScopedValue v(scope, m_v4Engine->newObject()); | - | ||||||||||||
108 | return executed 144 times by 6 tests: QJSValue(m_v4Engine, v->asReturnedValue());return QJSValue(m_v4Engine, v->asReturnedValue()); Executed by:
executed 144 times by 6 tests: return QJSValue(m_v4Engine, v->asReturnedValue()); Executed by:
| 144 | ||||||||||||
109 | } | - | ||||||||||||
110 | - | |||||||||||||
111 | - | |||||||||||||
112 | - | |||||||||||||
113 | - | |||||||||||||
114 | - | |||||||||||||
115 | - | |||||||||||||
116 | QJSValue QJSEngine::newArray(uint length) | - | ||||||||||||
117 | { | - | ||||||||||||
118 | QV4::Scope scope(m_v4Engine); | - | ||||||||||||
119 | QV4::ScopedArrayObject array(scope, m_v4Engine->newArrayObject()); | - | ||||||||||||
120 | if (length < 0x1000
| 2-32 | ||||||||||||
121 | array->arrayReserve(length); executed 32 times by 7 tests: array->arrayReserve(length); Executed by:
| 32 | ||||||||||||
122 | array->setArrayLengthUnchecked(length); | - | ||||||||||||
123 | return executed 34 times by 7 tests: QJSValue(m_v4Engine, array.asReturnedValue());return QJSValue(m_v4Engine, array.asReturnedValue()); Executed by:
executed 34 times by 7 tests: return QJSValue(m_v4Engine, array.asReturnedValue()); Executed by:
| 34 | ||||||||||||
124 | } | - | ||||||||||||
125 | QJSValue QJSEngine::newQObject(QObject *object) | - | ||||||||||||
126 | { | - | ||||||||||||
127 | ; | - | ||||||||||||
128 | QV4::ExecutionEngine *v4 = m_v4Engine; | - | ||||||||||||
129 | QV4::Scope scope(v4); | - | ||||||||||||
130 | if (object
| 6-282 | ||||||||||||
131 | QQmlData *ddata = QQmlData::get(object, true); | - | ||||||||||||
132 | if (!ddata
| 0-282 | ||||||||||||
133 | QQmlEngine::setObjectOwnership(object, QQmlEngine::JavaScriptOwnership); executed 260 times by 4 tests: QQmlEngine::setObjectOwnership(object, QQmlEngine::JavaScriptOwnership); Executed by:
| 260 | ||||||||||||
134 | } executed 282 times by 5 tests: end of block Executed by:
| 282 | ||||||||||||
135 | QV4::ScopedValue v(scope, QV4::QObjectWrapper::wrap(v4, object)); | - | ||||||||||||
136 | return executed 288 times by 5 tests: QJSValue(v4, v->asReturnedValue());return QJSValue(v4, v->asReturnedValue()); Executed by:
executed 288 times by 5 tests: return QJSValue(v4, v->asReturnedValue()); Executed by:
| 288 | ||||||||||||
137 | } | - | ||||||||||||
138 | QJSValue QJSEngine::newQMetaObject(const QMetaObject* metaObject) { | - | ||||||||||||
139 | ; | - | ||||||||||||
140 | QV4::ExecutionEngine *v4 = m_v4Engine; | - | ||||||||||||
141 | QV4::Scope scope(v4); | - | ||||||||||||
142 | QV4::ScopedValue v(scope, QV4::QMetaObjectWrapper::create(v4, metaObject)); | - | ||||||||||||
143 | return executed 6 times by 1 test: QJSValue(v4, v->asReturnedValue());return QJSValue(v4, v->asReturnedValue()); Executed by:
executed 6 times by 1 test: return QJSValue(v4, v->asReturnedValue()); Executed by:
| 6 | ||||||||||||
144 | } | - | ||||||||||||
145 | QJSValue QJSEngine::globalObject() const | - | ||||||||||||
146 | { | - | ||||||||||||
147 | QV4::Scope scope(m_v4Engine); | - | ||||||||||||
148 | QV4::ScopedValue v(scope, m_v4Engine->globalObject); | - | ||||||||||||
149 | return executed 348 times by 3 tests: QJSValue(m_v4Engine, v->asReturnedValue());return QJSValue(m_v4Engine, v->asReturnedValue()); Executed by:
executed 348 times by 3 tests: return QJSValue(m_v4Engine, v->asReturnedValue()); Executed by:
| 348 | ||||||||||||
150 | } | - | ||||||||||||
151 | - | |||||||||||||
152 | - | |||||||||||||
153 | - | |||||||||||||
154 | - | |||||||||||||
155 | - | |||||||||||||
156 | QJSValue QJSEngine::create(int type, const void *ptr) | - | ||||||||||||
157 | { | - | ||||||||||||
158 | QV4::Scope scope(m_v4Engine); | - | ||||||||||||
159 | QV4::ScopedValue v(scope, scope.engine->metaTypeToJS(type, ptr)); | - | ||||||||||||
160 | return executed 48668 times by 5 tests: QJSValue(m_v4Engine, v->asReturnedValue());return QJSValue(m_v4Engine, v->asReturnedValue()); Executed by:
executed 48668 times by 5 tests: return QJSValue(m_v4Engine, v->asReturnedValue()); Executed by:
| 48668 | ||||||||||||
161 | } | - | ||||||||||||
162 | - | |||||||||||||
163 | - | |||||||||||||
164 | - | |||||||||||||
165 | - | |||||||||||||
166 | - | |||||||||||||
167 | bool QJSEngine::convertV2(const QJSValue &value, int type, void *ptr) | - | ||||||||||||
168 | { | - | ||||||||||||
169 | QV4::ExecutionEngine *v4 = QJSValuePrivate::engine(&value); | - | ||||||||||||
170 | QV4::Value scratch; | - | ||||||||||||
171 | QV4::Value *val = QJSValuePrivate::valueForData(&value, &scratch); | - | ||||||||||||
172 | if (v4
| 152-330 | ||||||||||||
173 | QV4::Scope scope(v4); | - | ||||||||||||
174 | QV4::ScopedValue v(scope, *val); | - | ||||||||||||
175 | return executed 330 times by 4 tests: scope.engine->metaTypeFromJS(v, type, ptr);return scope.engine->metaTypeFromJS(v, type, ptr); Executed by:
executed 330 times by 4 tests: return scope.engine->metaTypeFromJS(v, type, ptr); Executed by:
| 330 | ||||||||||||
176 | } | - | ||||||||||||
177 | - | |||||||||||||
178 | if (!val
| 44-108 | ||||||||||||
179 | QVariant *variant = QJSValuePrivate::getVariant(&value); | - | ||||||||||||
180 | ((variant) ? static_cast<void>(0) : qt_assert("variant", __FILE__, 625)); | - | ||||||||||||
181 | - | |||||||||||||
182 | if (variant->userType() == QMetaType::QString
| 0-44 | ||||||||||||
183 | QString string = variant->toString(); | - | ||||||||||||
184 | - | |||||||||||||
185 | if (type == QMetaType::Bool
| 8-36 | ||||||||||||
186 | *reinterpret_cast<bool*>(ptr) = string.length() != 0; | - | ||||||||||||
187 | return executed 8 times by 1 test: true;return true; Executed by:
executed 8 times by 1 test: return true; Executed by:
| 8 | ||||||||||||
188 | } | - | ||||||||||||
189 | if (type == QMetaType::QString
| 2-34 | ||||||||||||
190 | *reinterpret_cast<QString*>(ptr) = string; | - | ||||||||||||
191 | return executed 2 times by 1 test: true;return true; Executed by:
executed 2 times by 1 test: return true; Executed by:
| 2 | ||||||||||||
192 | } | - | ||||||||||||
193 | double d = QV4::RuntimeHelpers::stringToNumber(string); | - | ||||||||||||
194 | switch (type) { | - | ||||||||||||
195 | case executed 14 times by 1 test: QMetaType::Int:case QMetaType::Int: Executed by:
executed 14 times by 1 test: case QMetaType::Int: Executed by:
| 14 | ||||||||||||
196 | *reinterpret_cast<int*>(ptr) = QV4::Primitive::toInt32(d); | - | ||||||||||||
197 | return executed 14 times by 1 test: true;return true; Executed by:
executed 14 times by 1 test: return true; Executed by:
| 14 | ||||||||||||
198 | case executed 14 times by 1 test: QMetaType::UInt:case QMetaType::UInt: Executed by:
executed 14 times by 1 test: case QMetaType::UInt: Executed by:
| 14 | ||||||||||||
199 | *reinterpret_cast<uint*>(ptr) = QV4::Primitive::toUInt32(d); | - | ||||||||||||
200 | return executed 14 times by 1 test: true;return true; Executed by:
executed 14 times by 1 test: return true; Executed by:
| 14 | ||||||||||||
201 | case never executed: QMetaType::LongLong:case QMetaType::LongLong: never executed: case QMetaType::LongLong: | 0 | ||||||||||||
202 | *reinterpret_cast<qlonglong*>(ptr) = QV4::Primitive::toInteger(d); | - | ||||||||||||
203 | return never executed: true;return true; never executed: return true; | 0 | ||||||||||||
204 | case never executed: QMetaType::ULongLong:case QMetaType::ULongLong: never executed: case QMetaType::ULongLong: | 0 | ||||||||||||
205 | *reinterpret_cast<qulonglong*>(ptr) = QV4::Primitive::toInteger(d); | - | ||||||||||||
206 | return never executed: true;return true; never executed: return true; | 0 | ||||||||||||
207 | case executed 4 times by 1 test: QMetaType::Double:case QMetaType::Double: Executed by:
executed 4 times by 1 test: case QMetaType::Double: Executed by:
| 4 | ||||||||||||
208 | *reinterpret_cast<double*>(ptr) = d; | - | ||||||||||||
209 | return executed 4 times by 1 test: true;return true; Executed by:
executed 4 times by 1 test: return true; Executed by:
| 4 | ||||||||||||
210 | case never executed: QMetaType::Float:case QMetaType::Float: never executed: case QMetaType::Float: | 0 | ||||||||||||
211 | *reinterpret_cast<float*>(ptr) = d; | - | ||||||||||||
212 | return never executed: true;return true; never executed: return true; | 0 | ||||||||||||
213 | case never executed: QMetaType::Short:case QMetaType::Short: never executed: case QMetaType::Short: | 0 | ||||||||||||
214 | *reinterpret_cast<short*>(ptr) = QV4::Primitive::toInt32(d); | - | ||||||||||||
215 | return never executed: true;return true; never executed: return true; | 0 | ||||||||||||
216 | case never executed: QMetaType::UShort:case QMetaType::UShort: never executed: case QMetaType::UShort: | 0 | ||||||||||||
217 | *reinterpret_cast<unsigned short*>(ptr) = QV4::Primitive::toUInt32(d); | - | ||||||||||||
218 | return never executed: true;return true; never executed: return true; | 0 | ||||||||||||
219 | case never executed: QMetaType::Char:case QMetaType::Char: never executed: case QMetaType::Char: | 0 | ||||||||||||
220 | *reinterpret_cast<char*>(ptr) = QV4::Primitive::toInt32(d); | - | ||||||||||||
221 | return never executed: true;return true; never executed: return true; | 0 | ||||||||||||
222 | case never executed: QMetaType::UChar:case QMetaType::UChar: never executed: case QMetaType::UChar: | 0 | ||||||||||||
223 | *reinterpret_cast<unsigned char*>(ptr) = QV4::Primitive::toUInt32(d); | - | ||||||||||||
224 | return never executed: true;return true; never executed: return true; | 0 | ||||||||||||
225 | case never executed: QMetaType::QChar:case QMetaType::QChar: never executed: case QMetaType::QChar: | 0 | ||||||||||||
226 | *reinterpret_cast<QChar*>(ptr) = QV4::Primitive::toUInt32(d); | - | ||||||||||||
227 | return never executed: true;return true; never executed: return true; | 0 | ||||||||||||
228 | default executed 2 times by 1 test: :default: Executed by:
executed 2 times by 1 test: default: Executed by:
| 2 | ||||||||||||
229 | return executed 2 times by 1 test: false;return false; Executed by:
executed 2 times by 1 test: return false; Executed by:
| 2 | ||||||||||||
230 | } | - | ||||||||||||
231 | } else { | - | ||||||||||||
232 | return never executed: QMetaType::convert(&variant->data_ptr(), variant->userType(), ptr, type);return QMetaType::convert(&variant->data_ptr(), variant->userType(), ptr, type); never executed: return QMetaType::convert(&variant->data_ptr(), variant->userType(), ptr, type); | 0 | ||||||||||||
233 | } | - | ||||||||||||
234 | } | - | ||||||||||||
235 | - | |||||||||||||
236 | ((val) ? static_cast<void>(0) : qt_assert("val", __FILE__, 681)); | - | ||||||||||||
237 | - | |||||||||||||
238 | switch (type) { | - | ||||||||||||
239 | case executed 28 times by 1 test: QMetaType::Bool:case QMetaType::Bool: Executed by:
executed 28 times by 1 test: case QMetaType::Bool: Executed by:
| 28 | ||||||||||||
240 | *reinterpret_cast<bool*>(ptr) = val->toBoolean(); | - | ||||||||||||
241 | return executed 28 times by 1 test: true;return true; Executed by:
executed 28 times by 1 test: return true; Executed by:
| 28 | ||||||||||||
242 | case executed 18 times by 1 test: QMetaType::Int:case QMetaType::Int: Executed by:
executed 18 times by 1 test: case QMetaType::Int: Executed by:
| 18 | ||||||||||||
243 | *reinterpret_cast<int*>(ptr) = val->toInt32(); | - | ||||||||||||
244 | return executed 18 times by 1 test: true;return true; Executed by:
executed 18 times by 1 test: return true; Executed by:
| 18 | ||||||||||||
245 | case executed 14 times by 1 test: QMetaType::UInt:case QMetaType::UInt: Executed by:
executed 14 times by 1 test: case QMetaType::UInt: Executed by:
| 14 | ||||||||||||
246 | *reinterpret_cast<uint*>(ptr) = val->toUInt32(); | - | ||||||||||||
247 | return executed 14 times by 1 test: true;return true; Executed by:
executed 14 times by 1 test: return true; Executed by:
| 14 | ||||||||||||
248 | case executed 2 times by 1 test: QMetaType::LongLong:case QMetaType::LongLong: Executed by:
executed 2 times by 1 test: case QMetaType::LongLong: Executed by:
| 2 | ||||||||||||
249 | *reinterpret_cast<qlonglong*>(ptr) = val->toInteger(); | - | ||||||||||||
250 | return executed 2 times by 1 test: true;return true; Executed by:
executed 2 times by 1 test: return true; Executed by:
| 2 | ||||||||||||
251 | case executed 2 times by 1 test: QMetaType::ULongLong:case QMetaType::ULongLong: Executed by:
executed 2 times by 1 test: case QMetaType::ULongLong: Executed by:
| 2 | ||||||||||||
252 | *reinterpret_cast<qulonglong*>(ptr) = val->toInteger(); | - | ||||||||||||
253 | return executed 2 times by 1 test: true;return true; Executed by:
executed 2 times by 1 test: return true; Executed by:
| 2 | ||||||||||||
254 | case executed 10 times by 2 tests: QMetaType::Double:case QMetaType::Double: Executed by:
executed 10 times by 2 tests: case QMetaType::Double: Executed by:
| 10 | ||||||||||||
255 | *reinterpret_cast<double*>(ptr) = val->toNumber(); | - | ||||||||||||
256 | return executed 10 times by 2 tests: true;return true; Executed by:
executed 10 times by 2 tests: return true; Executed by:
| 10 | ||||||||||||
257 | case executed 6 times by 1 test: QMetaType::QString:case QMetaType::QString: Executed by:
executed 6 times by 1 test: case QMetaType::QString: Executed by:
| 6 | ||||||||||||
258 | *reinterpret_cast<QString*>(ptr) = val->toQStringNoThrow(); | - | ||||||||||||
259 | return executed 6 times by 1 test: true;return true; Executed by:
executed 6 times by 1 test: return true; Executed by:
| 6 | ||||||||||||
260 | case executed 2 times by 1 test: QMetaType::Float:case QMetaType::Float: Executed by:
executed 2 times by 1 test: case QMetaType::Float: Executed by:
| 2 | ||||||||||||
261 | *reinterpret_cast<float*>(ptr) = val->toNumber(); | - | ||||||||||||
262 | return executed 2 times by 1 test: true;return true; Executed by:
executed 2 times by 1 test: return true; Executed by:
| 2 | ||||||||||||
263 | case executed 2 times by 1 test: QMetaType::Short:case QMetaType::Short: Executed by:
executed 2 times by 1 test: case QMetaType::Short: Executed by:
| 2 | ||||||||||||
264 | *reinterpret_cast<short*>(ptr) = val->toInt32(); | - | ||||||||||||
265 | return executed 2 times by 1 test: true;return true; Executed by:
executed 2 times by 1 test: return true; Executed by:
| 2 | ||||||||||||
266 | case executed 2 times by 1 test: QMetaType::UShort:case QMetaType::UShort: Executed by:
executed 2 times by 1 test: case QMetaType::UShort: Executed by:
| 2 | ||||||||||||
267 | *reinterpret_cast<unsigned short*>(ptr) = val->toUInt16(); | - | ||||||||||||
268 | return executed 2 times by 1 test: true;return true; Executed by:
executed 2 times by 1 test: return true; Executed by:
| 2 | ||||||||||||
269 | case executed 2 times by 1 test: QMetaType::Char:case QMetaType::Char: Executed by:
executed 2 times by 1 test: case QMetaType::Char: Executed by:
| 2 | ||||||||||||
270 | *reinterpret_cast<char*>(ptr) = val->toInt32(); | - | ||||||||||||
271 | return executed 2 times by 1 test: true;return true; Executed by:
executed 2 times by 1 test: return true; Executed by:
| 2 | ||||||||||||
272 | case executed 2 times by 1 test: QMetaType::UChar:case QMetaType::UChar: Executed by:
executed 2 times by 1 test: case QMetaType::UChar: Executed by:
| 2 | ||||||||||||
273 | *reinterpret_cast<unsigned char*>(ptr) = val->toUInt16(); | - | ||||||||||||
274 | return executed 2 times by 1 test: true;return true; Executed by:
executed 2 times by 1 test: return true; Executed by:
| 2 | ||||||||||||
275 | case never executed: QMetaType::QChar:case QMetaType::QChar: never executed: case QMetaType::QChar: | 0 | ||||||||||||
276 | *reinterpret_cast<QChar*>(ptr) = val->toUInt16(); | - | ||||||||||||
277 | return never executed: true;return true; never executed: return true; | 0 | ||||||||||||
278 | default executed 18 times by 1 test: :default: Executed by:
executed 18 times by 1 test: default: Executed by:
| 18 | ||||||||||||
279 | return executed 18 times by 1 test: false;return false; Executed by:
executed 18 times by 1 test: return false; Executed by:
| 18 | ||||||||||||
280 | } | - | ||||||||||||
281 | } | - | ||||||||||||
282 | void QJSEngine::throwError(const QString &message) | - | ||||||||||||
283 | { | - | ||||||||||||
284 | m_v4Engine->throwError(message); | - | ||||||||||||
285 | } executed 2 times by 1 test: end of block Executed by:
| 2 | ||||||||||||
286 | - | |||||||||||||
287 | QJSEnginePrivate *QJSEnginePrivate::get(QV4::ExecutionEngine *e) | - | ||||||||||||
288 | { | - | ||||||||||||
289 | return executed 369004 times by 44 tests: e->jsEngine()->d_func();return e->jsEngine()->d_func(); Executed by:
executed 369004 times by 44 tests: return e->jsEngine()->d_func(); Executed by:
| 369004 | ||||||||||||
290 | } | - | ||||||||||||
291 | - | |||||||||||||
292 | QJSEnginePrivate::~QJSEnginePrivate() | - | ||||||||||||
293 | { | - | ||||||||||||
294 | QQmlMetaType::freeUnusedTypesAndCaches(); | - | ||||||||||||
295 | } executed 10324 times by 151 tests: end of block Executed by:
| 10324 | ||||||||||||
296 | - | |||||||||||||
297 | void QJSEnginePrivate::addToDebugServer(QJSEngine *q) | - | ||||||||||||
298 | { | - | ||||||||||||
299 | if (QCoreApplication::instance()->thread() != q->thread()
| 10-10328 | ||||||||||||
300 | return; executed 10 times by 2 tests: return; Executed by:
| 10 | ||||||||||||
301 | - | |||||||||||||
302 | QQmlDebugConnector *server = QQmlDebugConnector::instance(); | - | ||||||||||||
303 | if (!server
| 0-10286 | ||||||||||||
304 | return; executed 10286 times by 145 tests: return; Executed by:
| 10286 | ||||||||||||
305 | - | |||||||||||||
306 | server->open(); | - | ||||||||||||
307 | server->addEngine(q); | - | ||||||||||||
308 | } executed 42 times by 7 tests: end of block Executed by:
| 42 | ||||||||||||
309 | - | |||||||||||||
310 | void QJSEnginePrivate::removeFromDebugServer(QJSEngine *q) | - | ||||||||||||
311 | { | - | ||||||||||||
312 | QQmlDebugConnector *server = QQmlDebugConnector::instance(); | - | ||||||||||||
313 | if (server
| 42-18038 | ||||||||||||
314 | server->removeEngine(q); executed 42 times by 7 tests: server->removeEngine(q); Executed by:
| 42 | ||||||||||||
315 | } executed 18132 times by 151 tests: end of block Executed by:
| 18132 | ||||||||||||
316 | QJSEngine *qjsEngine(const QObject *object) | - | ||||||||||||
317 | { | - | ||||||||||||
318 | QQmlData *data = QQmlData::get(object, false); | - | ||||||||||||
319 | if (!data
| 2-16 | ||||||||||||
320 | return executed 4 times by 1 test: nullptr;return nullptr; Executed by:
executed 4 times by 1 test: return nullptr; Executed by:
| 4 | ||||||||||||
321 | return executed 14 times by 3 tests: data->jsWrapper.engine()->jsEngine();return data->jsWrapper.engine()->jsEngine(); Executed by:
executed 14 times by 3 tests: return data->jsWrapper.engine()->jsEngine(); Executed by:
| 14 | ||||||||||||
322 | } | - | ||||||||||||
323 | - | |||||||||||||
324 | - | |||||||||||||
325 | - | |||||||||||||
Switch to Source code | Preprocessed file |