aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/compiler/qv4codegen.cpp
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2022-07-18 07:19:38 +0200
committerUlf Hermann <ulf.hermann@qt.io>2022-07-18 11:24:24 +0200
commit313f99cf891ec2406c32dc52ef81ef574c0f2e0e (patch)
tree4e0de25e56ce4e43b7ef147a04021f6b0f4de32d /src/qml/compiler/qv4codegen.cpp
parent1b8109fc1476e255d1fdb571da884215d9791cec (diff)
Codegen: Remove unnecessary check
The following cast() checks its argument again. However, as the "statement" member is not checked for null anywhere else, we can be pretty sure it actually is never null. So even the check in cast() should be unnecessary. Coverity-Id: 190165 Change-Id: I5a966a52fb3b509b2f3fee4e20c357679d422567 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qml/compiler/qv4codegen.cpp')
-rw-r--r--src/qml/compiler/qv4codegen.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/qml/compiler/qv4codegen.cpp b/src/qml/compiler/qv4codegen.cpp
index 1784d5bdf5..9d96f3562e 100644
--- a/src/qml/compiler/qv4codegen.cpp
+++ b/src/qml/compiler/qv4codegen.cpp
@@ -3277,7 +3277,8 @@ int Codegen::defineFunction(const QString &name, AST::Node *ast, AST::FormalPara
// at all, because if the onSignal is a signal handler, the user is actually making it explicit
// that the binding is a function, so we should execute that. However, we don't know that during
// 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);
+ _context->returnsClosure = body && cast<ExpressionStatement *>(body->statement)
+ && cast<FunctionExpression *>(cast<ExpressionStatement *>(body->statement)->expression);
BytecodeGenerator bytecode(_context->line, _module->debugMode, storeSourceLocations);
BytecodeGenerator *savedBytecodeGenerator;