diff options
author | Mitch Curtis <mitch.curtis@qt.io> | 2018-06-20 17:01:29 +0200 |
---|---|---|
committer | Mitch Curtis <mitch.curtis@qt.io> | 2018-06-20 15:08:31 +0000 |
commit | fceb04cf29764c815fb539d3d62ed26edcb78448 (patch) | |
tree | d0dc25231a6c7458475647f95b2465528944400c /src | |
parent | f82ce803816aeb43e487c29a28f0f0ed126621ca (diff) |
Script::parse(): improve "function expressions as statement" error msg
Change-Id: I3c54c90bfa48d2f6ba78b898413133e49b66c208
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/qml/jsruntime/qv4script.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/qml/jsruntime/qv4script.cpp b/src/qml/jsruntime/qv4script.cpp index afa7d2ed52..5cd62c90f1 100644 --- a/src/qml/jsruntime/qv4script.cpp +++ b/src/qml/jsruntime/qv4script.cpp @@ -91,9 +91,10 @@ void Script::parse() Module module(v4->debugger() != nullptr); if (sourceCode.startsWith(QLatin1String("function("))) { - qWarning() << "Warning: Using function expressions as statements in scripts in not compliant with the ECMAScript specification at\n" - << (sourceCode.leftRef(70) + QLatin1String("...")) - << "\nThis will throw a syntax error in Qt 5.12. If you want a function expression, surround it by parentheses."; + static const int snippetLength = 70; + qWarning() << "Warning: Using function expressions as statements in scripts is not compliant with the ECMAScript specification:\n" + << (sourceCode.leftRef(snippetLength) + QLatin1String("...")) + << "\nThis will throw a syntax error in Qt 5.12. If you want a function expression, surround it by parentheses."; } Engine ee, *engine = ⅇ |