aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4functionobject.cpp
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2024-05-15 10:39:06 +0200
committerUlf Hermann <ulf.hermann@qt.io>2024-05-16 13:39:52 +0200
commita97af71f00b11806efb06ff795244488ce74eda2 (patch)
treeb76b3e93177be2c9bf65ee87f4dc6be76c3275b1 /src/qml/jsruntime/qv4functionobject.cpp
parent3f6036de68313e03adcde5fdb28bfb23063554eb (diff)
QtQml: Add some asserts to help the code checker
The name of a bound function cannot be null. Amends commit 8b6a9403bf2e04d34b9b07d2780186029fab99d0 Change-Id: I8a32d4c2cc8170f1b5d722cd8c5b823aa2211975 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4functionobject.cpp')
-rw-r--r--src/qml/jsruntime/qv4functionobject.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/qml/jsruntime/qv4functionobject.cpp b/src/qml/jsruntime/qv4functionobject.cpp
index 7240500012..e9f91fbc06 100644
--- a/src/qml/jsruntime/qv4functionobject.cpp
+++ b/src/qml/jsruntime/qv4functionobject.cpp
@@ -54,6 +54,7 @@ void Heap::FunctionObject::init()
void Heap::JavaScriptFunctionObject::init(
QV4::ExecutionContext *scope, Function *function, QV4::String *n)
{
+ Q_ASSERT(n || function);
Scope s(scope->engine());
ScopedString name(s, n ? n->d() : function->name());
FunctionObject::init(s.engine, name);
@@ -713,6 +714,7 @@ void Heap::BoundFunction::init(
ScopedContext ctx(s, js->scope());
JavaScriptFunctionObject::init(ctx, js->function(), name);
} else {
+ Q_ASSERT(name);
JavaScriptFunctionObject::init(engine->rootContext(), nullptr, name);
}