aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/compiler/qv4codegen.cpp
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2022-06-15 14:16:11 +0200
committerUlf Hermann <ulf.hermann@qt.io>2022-07-07 19:33:39 +0200
commit38fdf2717d9c2432a9cd7de605f2e1c1517ff744 (patch)
treea24150dae1eb8715750048e0d605c88e16e1caab /src/qml/compiler/qv4codegen.cpp
parent3f3e961a5afe2e62f436f946c521ea4afab76dde (diff)
QmlCompiler: Handle trivial signal handler constructions
If the signal handler does nothing but return a closure, we have to compile the closure using the same signature as the outer signal handler. In order for this to work, we also have to detect unresolved argument types for signal handlers. Those are just as bad as unresolved argument types for other functions. Fixes: QTBUG-101531 Change-Id: Idb5b3994809d91a4b4ce936282685435eb75e670 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qml/compiler/qv4codegen.cpp')
-rw-r--r--src/qml/compiler/qv4codegen.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/qml/compiler/qv4codegen.cpp b/src/qml/compiler/qv4codegen.cpp
index 2bde68d9ff..1784d5bdf5 100644
--- a/src/qml/compiler/qv4codegen.cpp
+++ b/src/qml/compiler/qv4codegen.cpp
@@ -71,13 +71,14 @@ static inline void setJumpOutLocation(QV4::Moth::BytecodeGenerator *bytecodeGene
}
Codegen::Codegen(QV4::Compiler::JSUnitGenerator *jsUnitGenerator, bool strict,
- CodegenWarningInterface *interface)
+ CodegenWarningInterface *interface, bool storeSourceLocations)
: _module(nullptr),
_returnAddress(-1),
_context(nullptr),
_labelledStatement(nullptr),
jsUnitGenerator(jsUnitGenerator),
_strictMode(strict),
+ storeSourceLocations(storeSourceLocations),
_fileNameIsUrl(false),
_interface(interface)
{
@@ -3246,7 +3247,7 @@ static bool endsWithReturn(Module *module, Node *node)
}
int Codegen::defineFunction(const QString &name, AST::Node *ast, AST::FormalParameterList *formals,
- AST::StatementList *body, bool storeSourceLocation)
+ AST::StatementList *body)
{
enterContext(ast);
@@ -3278,7 +3279,7 @@ int Codegen::defineFunction(const QString &name, AST::Node *ast, AST::FormalPara
// AOT compilation, so mark the surrounding function as only-returning-a-closure.
_context->returnsClosure = body && body->statement && cast<ExpressionStatement *>(body->statement) && cast<FunctionExpression *>(cast<ExpressionStatement *>(body->statement)->expression);
- BytecodeGenerator bytecode(_context->line, _module->debugMode, storeSourceLocation);
+ BytecodeGenerator bytecode(_context->line, _module->debugMode, storeSourceLocations);
BytecodeGenerator *savedBytecodeGenerator;
savedBytecodeGenerator = bytecodeGenerator;
bytecodeGenerator = &bytecode;