From 0bba8d7411d0b1f1b547f9ac960e7d84769c7154 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Tue, 13 Jan 2015 16:59:22 +0100 Subject: Fix failing assertion in debug builds for JS that calls constants MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit For true() we generate IR that looks like this: temp = true result = call temp() and therefore the move at isel time has IR::Call as source and a temp as base for the call. However constant propagation in the optimizer transforms this to result = call true() and that's a case we didn't handle in the IR visitor. Since we have Runtime::callValue we can however handle this case as well and the run-time will consequently produce the expected run-time error. Change-Id: Ia94a8116388e66f9f339913307f68e33a5c18a19 Task-number: QTBUG-43819 Reviewed-by: Robin Burchell Reviewed-by: Jan Kundrát Reviewed-by: Erik Verbruggen --- src/qml/jsruntime/qv4runtime.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/qml/jsruntime/qv4runtime.cpp') 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); } -- cgit v1.2.3