aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4script.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/qml/jsruntime/qv4script.cpp')
-rw-r--r--src/qml/jsruntime/qv4script.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/qml/jsruntime/qv4script.cpp b/src/qml/jsruntime/qv4script.cpp
index d8f6ebbf48..357f638031 100644
--- a/src/qml/jsruntime/qv4script.cpp
+++ b/src/qml/jsruntime/qv4script.cpp
@@ -55,9 +55,14 @@ void Script::parse()
if (sourceCode.startsWith(QLatin1String("function("))) {
static const int snippetLength = 70;
- qWarning() << "Warning: Using function expressions as statements in scripts is not compliant with the ECMAScript specification:\n"
- << (QStringView{sourceCode}.left(snippetLength) + QLatin1String("..."))
- << "\nThis will throw a syntax error in Qt 5.12. If you want a function expression, surround it by parentheses.";
+ v4->throwSyntaxError(
+ QLatin1String(
+ "Using function expressions as statements in scripts is not compliant "
+ "with the ECMAScript specification:"
+ "\n%1...\n"
+ "If you want a function expression, surround it by parentheses.")
+ .arg(QStringView{sourceCode}.left(snippetLength)));
+ return;
}
Engine ee, *engine = &ee;