OpenCoverage

qv4script.cpp

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/qml/jsruntime/qv4script.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6-
7-
8using namespace QV4;-
9-
10Script::Script(ExecutionEngine *v4, QmlContext *qml, const QQmlRefPointer<CompiledData::CompilationUnit> &compilationUnit)-
11 : line(1), column(0), context(v4->rootContext()), strictMode(false), inheritContext(true), parsed(false)-
12 , compilationUnit(compilationUnit), vmFunction(nullptr), parseAsBinding(true)-
13{-
14 if (qml
qmlDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qmlcachegen
FALSEevaluated 250 times by 13 tests
Evaluated by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlcontext
  • tst_qqmlecmascript
  • tst_qqmlincubator
  • tst_qqmlqt
  • tst_qqmlsqldatabase
  • tst_qqmltranslation
  • tst_qqmlvaluetypes
  • tst_qquickanimationcontroller
  • tst_qquicklayouts
  • tst_quicktestmainwithsetup
  • tst_testfiltering
)
2-250
15 qmlContext.set(v4, *qml);
executed 2 times by 1 test: qmlContext.set(v4, *qml);
Executed by:
  • tst_qmlcachegen
2
16-
17 parsed = true;-
18-
19 vmFunction = compilationUnit
compilationUnitDescription
TRUEevaluated 252 times by 13 tests
Evaluated by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlcontext
  • tst_qqmlecmascript
  • tst_qqmlincubator
  • tst_qqmlqt
  • tst_qqmlsqldatabase
  • tst_qqmltranslation
  • tst_qqmlvaluetypes
  • tst_qquickanimationcontroller
  • tst_qquicklayouts
  • tst_quicktestmainwithsetup
  • tst_testfiltering
FALSEnever evaluated
? compilationUnit->linkToEngine(v4) : nullptr;
0-252
20}
executed 252 times by 13 tests: end of block
Executed by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlcontext
  • tst_qqmlecmascript
  • tst_qqmlincubator
  • tst_qqmlqt
  • tst_qqmlsqldatabase
  • tst_qqmltranslation
  • tst_qqmlvaluetypes
  • tst_qquickanimationcontroller
  • tst_qquicklayouts
  • tst_quicktestmainwithsetup
  • tst_testfiltering
252
21-
22Script::~Script()-
23{-
24}-
25-
26void Script::parse()-
27{-
28 if (parsed
parsedDescription
TRUEevaluated 22 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qqmlecmascript
  • tst_qquickworkerscript
FALSEevaluated 2818282 times by 31 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_examples
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qjsvalue
  • tst_qjsvalueiterator
  • tst_qmlcachegen
  • tst_qqmldebugjs
  • tst_qqmlecmascript
  • tst_qqmlenginedebugservice
  • tst_qqmlexpression
  • tst_qqmllistmodel
  • tst_qqmllistmodelworkerscript
  • tst_qqmlmetatype
  • tst_qqmlproperty
  • tst_qqmlqt
  • tst_qqmlxmlhttprequest
  • tst_qquickdesignersupport
  • tst_qquickdrag
  • tst_qquickdroparea
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickpositioners
  • tst_qquickrepeater
  • ...
)
22-2818282
29 return;
executed 22 times by 3 tests: return;
Executed by:
  • tst_examples
  • tst_qqmlecmascript
  • tst_qquickworkerscript
22
30-
31 using namespace QV4::Compiler;-
32-
33 parsed = true;-
34-
35 ExecutionEngine *v4 = context->engine();-
36 Scope valueScope(v4);-
37-
38 Module module(v4->debugger() != nullptr);-
39-
40 if (sourceCode.startsWith(QLatin1String("function("))
sourceCode.sta...("function("))Description
TRUEnever evaluated
FALSEevaluated 2817831 times by 31 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_examples
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qjsvalue
  • tst_qjsvalueiterator
  • tst_qmlcachegen
  • tst_qqmldebugjs
  • tst_qqmlecmascript
  • tst_qqmlenginedebugservice
  • tst_qqmlexpression
  • tst_qqmllistmodel
  • tst_qqmllistmodelworkerscript
  • tst_qqmlmetatype
  • tst_qqmlproperty
  • tst_qqmlqt
  • tst_qqmlxmlhttprequest
  • tst_qquickdesignersupport
  • tst_qquickdrag
  • tst_qquickdroparea
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickpositioners
  • tst_qquickrepeater
  • ...
) {
0-2817831
41 static const int snippetLength = 70;-
42 QMessageLogger(__FILE__, 95, __PRETTY_FUNCTION__).warning() << "Warning: Using function expressions as statements in scripts is not compliant with the ECMAScript specification:\n"-
43 << (sourceCode.leftRef(snippetLength) + QLatin1String("..."))-
44 << "\nThis will throw a syntax error in Qt 5.12. If you want a function expression, surround it by parentheses.";-
45 }
never executed: end of block
0
46-
47 Engine ee, *engine = &ee;-
48 Lexer lexer(engine);-
49 lexer.setCode(sourceCode, line, parseAsBinding);-
50 Parser parser(engine);-
51-
52 const bool parsed = parser.parseProgram();-
53-
54 const auto diagnosticMessages = parser.diagnosticMessages();-
55 for (const DiagnosticMessage &m : diagnosticMessages) {-
56 if (m.isError()
m.isError()Description
TRUEevaluated 4804 times by 7 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qjsengine
  • tst_qjsvalue
  • tst_qqmlecmascript
  • tst_qqmlexpression
  • tst_qquickvisualdatamodel
  • tst_qquickworkerscript
FALSEnever evaluated
) {
0-4804
57 valueScope.engine->throwSyntaxError(m.message, sourceFile, m.loc.startLine, m.loc.startColumn);-
58 return;
executed 4782 times by 7 tests: return;
Executed by:
  • tst_ecmascripttests
  • tst_qjsengine
  • tst_qjsvalue
  • tst_qqmlecmascript
  • tst_qqmlexpression
  • tst_qquickvisualdatamodel
  • tst_qquickworkerscript
4782
59 } else {-
60 QMessageLogger(__FILE__, 113, __PRETTY_FUNCTION__).warning() << sourceFile << ':' << m.loc.startLine << ':' << m.loc.startColumn-
61 << ": warning: " << m.message;-
62 }
never executed: end of block
0
63 }-
64-
65 if (parsed
parsedDescription
TRUEevaluated 2813723 times by 31 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_examples
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qjsvalue
  • tst_qjsvalueiterator
  • tst_qmlcachegen
  • tst_qqmldebugjs
  • tst_qqmlecmascript
  • tst_qqmlenginedebugservice
  • tst_qqmlexpression
  • tst_qqmllistmodel
  • tst_qqmllistmodelworkerscript
  • tst_qqmlmetatype
  • tst_qqmlproperty
  • tst_qqmlqt
  • tst_qqmlxmlhttprequest
  • tst_qquickdesignersupport
  • tst_qquickdrag
  • tst_qquickdroparea
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickpositioners
  • tst_qquickrepeater
  • ...
FALSEevaluated 316 times by 1 test
Evaluated by:
  • tst_ecmascripttests
) {
316-2813723
66 using namespace AST;-
67 Program *program = AST::cast<Program *>(parser.rootNode());-
68 if (!program
!programDescription
TRUEevaluated 523002 times by 3 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qjsengine
  • tst_qqmlecmascript
FALSEevaluated 2288635 times by 31 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_examples
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qjsvalue
  • tst_qjsvalueiterator
  • tst_qmlcachegen
  • tst_qqmldebugjs
  • tst_qqmlecmascript
  • tst_qqmlenginedebugservice
  • tst_qqmlexpression
  • tst_qqmllistmodel
  • tst_qqmllistmodelworkerscript
  • tst_qqmlmetatype
  • tst_qqmlproperty
  • tst_qqmlqt
  • tst_qqmlxmlhttprequest
  • tst_qquickdesignersupport
  • tst_qquickdrag
  • tst_qquickdroparea
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickpositioners
  • tst_qquickrepeater
  • ...
) {
523002-2288635
69-
70-
71 return;
executed 522737 times by 3 tests: return;
Executed by:
  • tst_ecmascripttests
  • tst_qjsengine
  • tst_qqmlecmascript
522737
72 }-
73-
74 QV4::Compiler::JSUnitGenerator jsGenerator(&module);-
75 RuntimeCodegen cg(v4, &jsGenerator, strictMode);-
76 if (inheritContext
inheritContextDescription
TRUEevaluated 1677898 times by 29 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_examples
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qjsvalue
  • tst_qjsvalueiterator
  • tst_qqmldebugjs
  • tst_qqmlecmascript
  • tst_qqmlenginedebugservice
  • tst_qqmlexpression
  • tst_qqmllistmodel
  • tst_qqmllistmodelworkerscript
  • tst_qqmlmetatype
  • tst_qqmlproperty
  • tst_qqmlqt
  • tst_qqmlxmlhttprequest
  • tst_qquickdesignersupport
  • tst_qquickdrag
  • tst_qquickdroparea
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickpositioners
  • tst_qquickrepeater
  • tst_qquickstates
  • ...
FALSEevaluated 611236 times by 8 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_examples
  • tst_qjsengine
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
  • tst_qv4assembler
)
611236-1677898
77 cg.setUseFastLookups(false);
executed 1677898 times by 29 tests: cg.setUseFastLookups(false);
Executed by:
  • tst_ecmascripttests
  • tst_examples
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qjsvalue
  • tst_qjsvalueiterator
  • tst_qqmldebugjs
  • tst_qqmlecmascript
  • tst_qqmlenginedebugservice
  • tst_qqmlexpression
  • tst_qqmllistmodel
  • tst_qqmllistmodelworkerscript
  • tst_qqmlmetatype
  • tst_qqmlproperty
  • tst_qqmlqt
  • tst_qqmlxmlhttprequest
  • tst_qquickdesignersupport
  • tst_qquickdrag
  • tst_qquickdroparea
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickpositioners
  • tst_qquickrepeater
  • tst_qquickstates
  • ...
1677898
78 cg.generateFromProgram(sourceFile, sourceFile, sourceCode, program, &module, contextType);-
79 if (v4->hasException
v4->hasExceptionDescription
TRUEevaluated 1212 times by 3 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qjsengine
  • tst_qqmlecmascript
FALSEevaluated 2286334 times by 31 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_examples
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qjsvalue
  • tst_qjsvalueiterator
  • tst_qmlcachegen
  • tst_qqmldebugjs
  • tst_qqmlecmascript
  • tst_qqmlenginedebugservice
  • tst_qqmlexpression
  • tst_qqmllistmodel
  • tst_qqmllistmodelworkerscript
  • tst_qqmlmetatype
  • tst_qqmlproperty
  • tst_qqmlqt
  • tst_qqmlxmlhttprequest
  • tst_qquickdesignersupport
  • tst_qquickdrag
  • tst_qquickdroparea
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickpositioners
  • tst_qquickrepeater
  • ...
)
1212-2286334
80 return;
executed 1205 times by 3 tests: return;
Executed by:
  • tst_ecmascripttests
  • tst_qjsengine
  • tst_qqmlecmascript
1205
81-
82 compilationUnit = cg.generateCompilationUnit();-
83 vmFunction = compilationUnit->linkToEngine(v4);-
84 }
executed 2288281 times by 31 tests: end of block
Executed by:
  • tst_ecmascripttests
  • tst_examples
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qjsvalue
  • tst_qjsvalueiterator
  • tst_qmlcachegen
  • tst_qqmldebugjs
  • tst_qqmlecmascript
  • tst_qqmlenginedebugservice
  • tst_qqmlexpression
  • tst_qqmllistmodel
  • tst_qqmllistmodelworkerscript
  • tst_qqmlmetatype
  • tst_qqmlproperty
  • tst_qqmlqt
  • tst_qqmlxmlhttprequest
  • tst_qquickdesignersupport
  • tst_qquickdrag
  • tst_qquickdroparea
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickpositioners
  • tst_qquickrepeater
  • ...
2288281
85-
86 if (!vmFunction
!vmFunctionDescription
TRUEevaluated 316 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 2288254 times by 31 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_examples
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qjsvalue
  • tst_qjsvalueiterator
  • tst_qmlcachegen
  • tst_qqmldebugjs
  • tst_qqmlecmascript
  • tst_qqmlenginedebugservice
  • tst_qqmlexpression
  • tst_qqmllistmodel
  • tst_qqmllistmodelworkerscript
  • tst_qqmlmetatype
  • tst_qqmlproperty
  • tst_qqmlqt
  • tst_qqmlxmlhttprequest
  • tst_qquickdesignersupport
  • tst_qquickdrag
  • tst_qquickdroparea
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickpositioners
  • tst_qquickrepeater
  • ...
) {
316-2288254
87-
88 ScopedObject error(valueScope, v4->newSyntaxErrorObject(([]() noexcept -> QString { enum { Size = sizeof(u"" "Syntax error")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "Syntax error" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return
executed 316 times by 1 test: return qstring_literal_temp;
Executed by:
  • tst_ecmascripttests
qstring_literal_temp;
executed 316 times by 1 test: return qstring_literal_temp;
Executed by:
  • tst_ecmascripttests
}())));
316
89 v4->throwError(error);-
90 }
executed 317 times by 1 test: end of block
Executed by:
  • tst_ecmascripttests
317
91}
executed 2288656 times by 31 tests: end of block
Executed by:
  • tst_ecmascripttests
  • tst_examples
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qjsvalue
  • tst_qjsvalueiterator
  • tst_qmlcachegen
  • tst_qqmldebugjs
  • tst_qqmlecmascript
  • tst_qqmlenginedebugservice
  • tst_qqmlexpression
  • tst_qqmllistmodel
  • tst_qqmllistmodelworkerscript
  • tst_qqmlmetatype
  • tst_qqmlproperty
  • tst_qqmlqt
  • tst_qqmlxmlhttprequest
  • tst_qquickdesignersupport
  • tst_qquickdrag
  • tst_qquickdroparea
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickpositioners
  • tst_qquickrepeater
  • ...
2288656
92-
93ReturnedValue Script::run(const QV4::Value *thisObject)-
94{-
95 if (!parsed
!parsedDescription
TRUEevaluated 2374 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
FALSEevaluated 118459 times by 26 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_examples
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qjsvalue
  • tst_qjsvalueiterator
  • tst_qmlcachegen
  • tst_qqmlcontext
  • tst_qqmldebugjs
  • tst_qqmlecmascript
  • tst_qqmlenginedebugservice
  • tst_qqmlincubator
  • tst_qqmllistmodelworkerscript
  • tst_qqmlproperty
  • tst_qqmlqt
  • tst_qqmlsqldatabase
  • tst_qqmltranslation
  • tst_qqmlvaluetypes
  • tst_qqmlxmlhttprequest
  • tst_qquickanimationcontroller
  • tst_qquicklayouts
  • tst_qquickworkerscript
  • tst_quicktestmainwithsetup
  • tst_qv4assembler
  • tst_qv4debugger
  • ...
)
2374-118459
96 parse();
executed 2374 times by 5 tests: parse();
Executed by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
2374
97 if (!vmFunction
!vmFunctionDescription
TRUEevaluated 12 times by 2 tests
Evaluated by:
  • tst_qjsengine
  • tst_qqmlecmascript
FALSEevaluated 121381 times by 26 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_examples
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qjsvalue
  • tst_qjsvalueiterator
  • tst_qmlcachegen
  • tst_qqmlcontext
  • tst_qqmldebugjs
  • tst_qqmlecmascript
  • tst_qqmlenginedebugservice
  • tst_qqmlincubator
  • tst_qqmllistmodelworkerscript
  • tst_qqmlproperty
  • tst_qqmlqt
  • tst_qqmlsqldatabase
  • tst_qqmltranslation
  • tst_qqmlvaluetypes
  • tst_qqmlxmlhttprequest
  • tst_qquickanimationcontroller
  • tst_qquicklayouts
  • tst_qquickworkerscript
  • tst_quicktestmainwithsetup
  • tst_qv4assembler
  • tst_qv4debugger
  • ...
)
12-121381
98 return
executed 12 times by 2 tests: return Encode::undefined();
Executed by:
  • tst_qjsengine
  • tst_qqmlecmascript
Encode::undefined();
executed 12 times by 2 tests: return Encode::undefined();
Executed by:
  • tst_qjsengine
  • tst_qqmlecmascript
12
99-
100 QV4::ExecutionEngine *engine = context->engine();-
101 QV4::Scope valueScope(engine);-
102-
103 if (qmlContext.isUndefined()
qmlContext.isUndefined()Description
TRUEevaluated 119455 times by 14 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_examples
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qjsvalue
  • tst_qjsvalueiterator
  • tst_qmlcachegen
  • tst_qqmldebugjs
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qqmlxmlhttprequest
  • tst_qquickworkerscript
  • tst_qv4assembler
  • tst_qv4debugger
FALSEevaluated 1498 times by 17 tests
Evaluated by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlcontext
  • tst_qqmlecmascript
  • tst_qqmlenginedebugservice
  • tst_qqmlincubator
  • tst_qqmllistmodelworkerscript
  • tst_qqmlproperty
  • tst_qqmlqt
  • tst_qqmlsqldatabase
  • tst_qqmltranslation
  • tst_qqmlvaluetypes
  • tst_qquickanimationcontroller
  • tst_qquicklayouts
  • tst_qquickworkerscript
  • tst_quicktestmainwithsetup
  • tst_testfiltering
) {
1498-119455
104 TemporaryAssignment<Function*> savedGlobalCode(engine->globalCode, vmFunction);-
105-
106 return
executed 119728 times by 14 tests: return vmFunction->call(thisObject ? thisObject : engine->globalObject, nullptr, 0, context);
Executed by:
  • tst_ecmascripttests
  • tst_examples
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qjsvalue
  • tst_qjsvalueiterator
  • tst_qmlcachegen
  • tst_qqmldebugjs
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qqmlxmlhttprequest
  • tst_qquickworkerscript
  • tst_qv4assembler
  • tst_qv4debugger
vmFunction->call(thisObject ? thisObject : engine->globalObject, nullptr, 0,
executed 119728 times by 14 tests: return vmFunction->call(thisObject ? thisObject : engine->globalObject, nullptr, 0, context);
Executed by:
  • tst_ecmascripttests
  • tst_examples
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qjsvalue
  • tst_qjsvalueiterator
  • tst_qmlcachegen
  • tst_qqmldebugjs
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qqmlxmlhttprequest
  • tst_qquickworkerscript
  • tst_qv4assembler
  • tst_qv4debugger
119728
107 context);
executed 119728 times by 14 tests: return vmFunction->call(thisObject ? thisObject : engine->globalObject, nullptr, 0, context);
Executed by:
  • tst_ecmascripttests
  • tst_examples
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qjsvalue
  • tst_qjsvalueiterator
  • tst_qmlcachegen
  • tst_qqmldebugjs
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qqmlxmlhttprequest
  • tst_qquickworkerscript
  • tst_qv4assembler
  • tst_qv4debugger
119728
108 } else {-
109 Scoped<QmlContext> qml(valueScope, qmlContext.value());-
110 return
executed 1498 times by 17 tests: return vmFunction->call(thisObject, nullptr, 0, qml);
Executed by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlcontext
  • tst_qqmlecmascript
  • tst_qqmlenginedebugservice
  • tst_qqmlincubator
  • tst_qqmllistmodelworkerscript
  • tst_qqmlproperty
  • tst_qqmlqt
  • tst_qqmlsqldatabase
  • tst_qqmltranslation
  • tst_qqmlvaluetypes
  • tst_qquickanimationcontroller
  • tst_qquicklayouts
  • tst_qquickworkerscript
  • tst_quicktestmainwithsetup
  • tst_testfiltering
vmFunction->call(thisObject, nullptr, 0, qml);
executed 1498 times by 17 tests: return vmFunction->call(thisObject, nullptr, 0, qml);
Executed by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlcontext
  • tst_qqmlecmascript
  • tst_qqmlenginedebugservice
  • tst_qqmlincubator
  • tst_qqmllistmodelworkerscript
  • tst_qqmlproperty
  • tst_qqmlqt
  • tst_qqmlsqldatabase
  • tst_qqmltranslation
  • tst_qqmlvaluetypes
  • tst_qquickanimationcontroller
  • tst_qquicklayouts
  • tst_qquickworkerscript
  • tst_quicktestmainwithsetup
  • tst_testfiltering
1498
111 }-
112}-
113-
114Function *Script::function()-
115{-
116 if (!parsed
!parsedDescription
TRUEnever evaluated
FALSEevaluated 1577457 times by 7 tests
Evaluated by:
  • tst_ecmascripttests
  • tst_qjsengine
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qqmlmetatype
  • tst_qqmlqt
  • tst_qquickworkerscript
)
0-1577457
117 parse();
never executed: parse();
0
118 return
executed 1577049 times by 7 tests: return vmFunction;
Executed by:
  • tst_ecmascripttests
  • tst_qjsengine
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qqmlmetatype
  • tst_qqmlqt
  • tst_qquickworkerscript
vmFunction;
executed 1577049 times by 7 tests: return vmFunction;
Executed by:
  • tst_ecmascripttests
  • tst_qjsengine
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qqmlmetatype
  • tst_qqmlqt
  • tst_qquickworkerscript
1577049
119}-
120-
121QQmlRefPointer<QV4::CompiledData::CompilationUnit> Script::precompile(QV4::Compiler::Module *module, QQmlJS::Engine *jsEngine, Compiler::JSUnitGenerator *unitGenerator,-
122 const QString &fileName, const QString &finalUrl, const QString &source,-
123 QList<QQmlError> *reportedErrors)-
124{-
125 using namespace QV4::Compiler;-
126 using namespace QQmlJS::AST;-
127-
128 Lexer lexer(jsEngine);-
129 lexer.setCode(source, 1, false);-
130 Parser parser(jsEngine);-
131-
132 parser.parseProgram();-
133-
134 QList<QQmlError> errors;-
135-
136 const auto diagnosticMessages = parser.diagnosticMessages();-
137 for (const DiagnosticMessage &m : diagnosticMessages) {-
138 if (m.isWarning()
m.isWarning()Description
TRUEnever evaluated
FALSEevaluated 26 times by 1 test
Evaluated by:
  • tst_qqmlecmascript
) {
0-26
139 QMessageLogger(__FILE__, 192, __PRETTY_FUNCTION__).warning("%s:%d : %s", QtPrivate::asString(fileName).toLocal8Bit().constData(), m.loc.startLine, QtPrivate::asString(m.message).toLocal8Bit().constData());-
140 continue;
never executed: continue;
0
141 }-
142-
143 QQmlError error;-
144 error.setUrl(QUrl(fileName));-
145 error.setDescription(m.message);-
146 error.setLine(m.loc.startLine);-
147 error.setColumn(m.loc.startColumn);-
148 errors << error;-
149 }
executed 26 times by 1 test: end of block
Executed by:
  • tst_qqmlecmascript
26
150-
151 if (!errors.isEmpty()
!errors.isEmpty()Description
TRUEevaluated 26 times by 1 test
Evaluated by:
  • tst_qqmlecmascript
FALSEevaluated 90 times by 12 tests
Evaluated by:
  • tst_examples
  • tst_qqmlcontext
  • tst_qqmlecmascript
  • tst_qqmlincubator
  • tst_qqmlqt
  • tst_qqmlsqldatabase
  • tst_qqmltranslation
  • tst_qqmlvaluetypes
  • tst_qquickanimationcontroller
  • tst_qquicklayouts
  • tst_quicktestmainwithsetup
  • tst_testfiltering
) {
26-90
152 if (reportedErrors
reportedErrorsDescription
TRUEevaluated 26 times by 1 test
Evaluated by:
  • tst_qqmlecmascript
FALSEnever evaluated
)
0-26
153 *
executed 26 times by 1 test: *reportedErrors << errors;
Executed by:
  • tst_qqmlecmascript
reportedErrors << errors;
executed 26 times by 1 test: *reportedErrors << errors;
Executed by:
  • tst_qqmlecmascript
26
154 return
executed 26 times by 1 test: return nullptr;
Executed by:
  • tst_qqmlecmascript
nullptr;
executed 26 times by 1 test: return nullptr;
Executed by:
  • tst_qqmlecmascript
26
155 }-
156-
157 Program *program = AST::cast<Program *>(parser.rootNode());-
158 if (!program
!programDescription
TRUEnever evaluated
FALSEevaluated 90 times by 12 tests
Evaluated by:
  • tst_examples
  • tst_qqmlcontext
  • tst_qqmlecmascript
  • tst_qqmlincubator
  • tst_qqmlqt
  • tst_qqmlsqldatabase
  • tst_qqmltranslation
  • tst_qqmlvaluetypes
  • tst_qquickanimationcontroller
  • tst_qquicklayouts
  • tst_quicktestmainwithsetup
  • tst_testfiltering
) {
0-90
159-
160-
161 return
never executed: return nullptr;
nullptr;
never executed: return nullptr;
0
162 }-
163-
164 Codegen cg(unitGenerator, false);-
165 cg.setUseFastLookups(false);-
166 cg.generateFromProgram(fileName, finalUrl, source, program, module, ContextType::Global);-
167 errors = cg.qmlErrors();-
168 if (!errors.isEmpty()
!errors.isEmpty()Description
TRUEnever evaluated
FALSEevaluated 90 times by 12 tests
Evaluated by:
  • tst_examples
  • tst_qqmlcontext
  • tst_qqmlecmascript
  • tst_qqmlincubator
  • tst_qqmlqt
  • tst_qqmlsqldatabase
  • tst_qqmltranslation
  • tst_qqmlvaluetypes
  • tst_qquickanimationcontroller
  • tst_qquicklayouts
  • tst_quicktestmainwithsetup
  • tst_testfiltering
) {
0-90
169 if (reportedErrors
reportedErrorsDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
170 *
never executed: *reportedErrors << errors;
reportedErrors << errors;
never executed: *reportedErrors << errors;
0
171 return
never executed: return nullptr;
nullptr;
never executed: return nullptr;
0
172 }-
173-
174 return
executed 90 times by 12 tests: return cg.generateCompilationUnit( false);
Executed by:
  • tst_examples
  • tst_qqmlcontext
  • tst_qqmlecmascript
  • tst_qqmlincubator
  • tst_qqmlqt
  • tst_qqmlsqldatabase
  • tst_qqmltranslation
  • tst_qqmlvaluetypes
  • tst_qquickanimationcontroller
  • tst_qquicklayouts
  • tst_quicktestmainwithsetup
  • tst_testfiltering
cg.generateCompilationUnit( false);
executed 90 times by 12 tests: return cg.generateCompilationUnit( false);
Executed by:
  • tst_examples
  • tst_qqmlcontext
  • tst_qqmlecmascript
  • tst_qqmlincubator
  • tst_qqmlqt
  • tst_qqmlsqldatabase
  • tst_qqmltranslation
  • tst_qqmlvaluetypes
  • tst_qquickanimationcontroller
  • tst_qquicklayouts
  • tst_quicktestmainwithsetup
  • tst_testfiltering
90
175}-
176-
177Script *Script::createFromFileOrCache(ExecutionEngine *engine, QmlContext *qmlContext, const QString &fileName, const QUrl &originalUrl, QString *error)-
178{-
179 if (error
errorDescription
TRUEevaluated 1178 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
FALSEnever evaluated
)
0-1178
180 error->clear();
executed 1178 times by 5 tests: error->clear();
Executed by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
1178
181-
182 QQmlMetaType::CachedUnitLookupError cacheError = QQmlMetaType::CachedUnitLookupError::NoError;-
183 if (const
const QV4::Com..., &cacheError)Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qmlcachegen
FALSEevaluated 1176 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
QV4::CompiledData::Unit *cachedUnit = QQmlMetaType::findCachedCompilationUnit(originalUrl, &cacheError)
const QV4::Com..., &cacheError)Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qmlcachegen
FALSEevaluated 1176 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
) {
2-1176
184 QQmlRefPointer<QV4::CompiledData::CompilationUnit> jsUnit;-
185 jsUnit.adopt(new QV4::CompiledData::CompilationUnit(cachedUnit));-
186 return
executed 2 times by 1 test: return new QV4::Script(engine, qmlContext, jsUnit);
Executed by:
  • tst_qmlcachegen
new QV4::Script(engine, qmlContext, jsUnit);
executed 2 times by 1 test: return new QV4::Script(engine, qmlContext, jsUnit);
Executed by:
  • tst_qmlcachegen
2
187 }-
188-
189 QFile f(fileName);-
190 if (!f.open(QIODevice::ReadOnly)
!f.open(QIODevice::ReadOnly)Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qqmlecmascript
FALSEevaluated 1174 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
) {
2-1174
191 if (error
errorDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qqmlecmascript
FALSEnever evaluated
) {
0-2
192 if (cacheError == QQmlMetaType::CachedUnitLookupError::VersionMismatch
cacheError == ...ersionMismatchDescription
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qqmlecmascript
)
0-2
193 *
never executed: *error = originalUrl.toString() + QString::fromUtf8(" was compiled ahead of time with an incompatible version of Qt and the original source code cannot be found. Please recompile");
error = originalUrl.toString() + QString::fromUtf8(" was compiled ahead of time with an incompatible version of Qt and the original source code cannot be found. Please recompile");
never executed: *error = originalUrl.toString() + QString::fromUtf8(" was compiled ahead of time with an incompatible version of Qt and the original source code cannot be found. Please recompile");
0
194 else-
195 *
executed 2 times by 1 test: *error = QString::fromUtf8("Error opening source file %1: %2").arg(originalUrl.toString()).arg(f.errorString());
Executed by:
  • tst_qqmlecmascript
error = QString::fromUtf8("Error opening source file %1: %2").arg(originalUrl.toString()).arg(f.errorString());
executed 2 times by 1 test: *error = QString::fromUtf8("Error opening source file %1: %2").arg(originalUrl.toString()).arg(f.errorString());
Executed by:
  • tst_qqmlecmascript
2
196 }-
197 return
executed 2 times by 1 test: return nullptr;
Executed by:
  • tst_qqmlecmascript
nullptr;
executed 2 times by 1 test: return nullptr;
Executed by:
  • tst_qqmlecmascript
2
198 }-
199-
200 QByteArray data = f.readAll();-
201 QString sourceCode = QString::fromUtf8(data);-
202 QmlIR::Document::removeScriptPragmas(sourceCode);-
203-
204 auto result = new QV4::Script(engine, qmlContext, sourceCode, originalUrl.toString());-
205 result->parse();-
206 return
executed 1174 times by 4 tests: return result;
Executed by:
  • tst_examples
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
result;
executed 1174 times by 4 tests: return result;
Executed by:
  • tst_examples
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
1174
207}-
208-
209QV4::ReturnedValue Script::evaluate(ExecutionEngine *engine, const QString &script, QmlContext *qmlContext)-
210{-
211 QV4::Scope scope(engine);-
212 QV4::Script qmlScript(engine, qmlContext, script, QString());-
213-
214 qmlScript.parse();-
215 QV4::ScopedValue result(scope);-
216 if (!scope.engine->hasException
!scope.engine->hasExceptionDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
217 result = qmlScript.run();
never executed: result = qmlScript.run();
0
218 if (scope.engine->hasException
scope.engine->hasExceptionDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
219 scope.engine->catchException();-
220 return
never executed: return Encode::undefined();
Encode::undefined();
never executed: return Encode::undefined();
0
221 }-
222 return
never executed: return result->asReturnedValue();
result->asReturnedValue();
never executed: return result->asReturnedValue();
0
223}-
Switch to Source codePreprocessed file

Generated by Squish Coco 4.2.0