aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@theqtcompany.com>2015-01-13 16:59:22 +0100
committerSimon Hausmann <simon.hausmann@digia.com>2015-01-15 11:29:37 +0100
commit0bba8d7411d0b1f1b547f9ac960e7d84769c7154 (patch)
tree550683a5957e492ed2a19def03d02656be223ddc /tests
parent88e87647c3b7d651dba2c8e61f945d47ecdd02c4 (diff)
Fix failing assertion in debug builds for JS that calls constants
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 <robin.burchell@viroteck.net> Reviewed-by: Jan Kundrát <jkt@kde.org> Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qml/qjsengine/tst_qjsengine.cpp2
1 files changed, 2 insertions, 0 deletions
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()