aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/qml/compiler/qv4isel_p.cpp2
-rw-r--r--src/qml/jsruntime/qv4runtime.cpp2
-rw-r--r--tests/auto/qml/qjsengine/tst_qjsengine.cpp2
3 files changed, 4 insertions, 2 deletions
diff --git a/src/qml/compiler/qv4isel_p.cpp b/src/qml/compiler/qv4isel_p.cpp
index e419084238..4bb866616d 100644
--- a/src/qml/compiler/qv4isel_p.cpp
+++ b/src/qml/compiler/qv4isel_p.cpp
@@ -182,7 +182,7 @@ void IRDecoder::visitMove(IR::Move *s)
} else if (Subscript *ss = c->base->asSubscript()) {
callSubscript(ss->base, ss->index, c->args, s->target);
return;
- } else if (c->base->asTemp() || c->base->asArgLocal()) {
+ } else if (c->base->asTemp() || c->base->asArgLocal() || c->base->asConst()) {
callValue(c->base, c->args, s->target);
return;
}
diff --git a/src/qml/jsruntime/qv4runtime.cpp b/src/qml/jsruntime/qv4runtime.cpp
index f72f25bd58..b019d4db14 100644
--- a/src/qml/jsruntime/qv4runtime.cpp
+++ b/src/qml/jsruntime/qv4runtime.cpp
@@ -961,7 +961,7 @@ ReturnedValue Runtime::callElement(ExecutionContext *context, const ValueRef ind
ReturnedValue Runtime::callValue(ExecutionContext *context, const ValueRef func, CallData *callData)
{
if (!func->isObject())
- return context->throwTypeError();
+ return context->throwTypeError(QStringLiteral("%1 is not a function").arg(func->toQStringNoThrow()));
return func->objectValue()->call(callData);
}
diff --git a/tests/auto/qml/qjsengine/tst_qjsengine.cpp b/tests/auto/qml/qjsengine/tst_qjsengine.cpp
index d24a1a4f20..158ee1589a 100644
--- a/tests/auto/qml/qjsengine/tst_qjsengine.cpp
+++ b/tests/auto/qml/qjsengine/tst_qjsengine.cpp
@@ -3140,6 +3140,8 @@ void tst_QJSEngine::callConstants()
" var one; one();\n"
" var two = null; two();\n"
"}\n");
+ QJSValue exceptionResult = engine.evaluate("true()");
+ QCOMPARE(exceptionResult.toString(), QString("TypeError: true is not a function"));
}
void tst_QJSEngine::installTranslatorFunctions()