diff options
author | Simon Hausmann <simon.hausmann@qt.io> | 2018-11-29 11:05:04 +0100 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@qt.io> | 2018-11-29 11:38:51 +0000 |
commit | 2fa1c92cb7e60f89e200eff48cf7e76d8d2febe6 (patch) | |
tree | 4b3218530ade7938bc25adcc4c43a6126866b29c /src/qml/jsruntime/qv4script.cpp | |
parent | 597ce09c7a1d8b89e9473faae900321ef2d4181d (diff) |
Fix parsing of js files via Qt.include()
Make sure to parse them as JavaScript, not as QML, so that certain
keywords such as char or double map to identifiers as expected.
Also removed an unused function.
Fixes: QTBUG-71524
Change-Id: Ie8a8dabe717ee12def6af512943e6d01efcf9876
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4script.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4script.cpp | 18 |
1 files changed, 1 insertions, 17 deletions
diff --git a/src/qml/jsruntime/qv4script.cpp b/src/qml/jsruntime/qv4script.cpp index 951675b468..f80db86be5 100644 --- a/src/qml/jsruntime/qv4script.cpp +++ b/src/qml/jsruntime/qv4script.cpp @@ -240,23 +240,7 @@ Script *Script::createFromFileOrCache(ExecutionEngine *engine, QmlContext *qmlCo QString sourceCode = QString::fromUtf8(data); QmlIR::Document::removeScriptPragmas(sourceCode); - auto result = new QV4::Script(engine, qmlContext, sourceCode, originalUrl.toString()); + auto result = new QV4::Script(engine, qmlContext, /*parseAsBinding*/false, sourceCode, originalUrl.toString()); result->parse(); return result; } - -QV4::ReturnedValue Script::evaluate(ExecutionEngine *engine, const QString &script, QmlContext *qmlContext) -{ - QV4::Scope scope(engine); - QV4::Script qmlScript(engine, qmlContext, script, QString()); - - qmlScript.parse(); - QV4::ScopedValue result(scope); - if (!scope.engine->hasException) - result = qmlScript.run(); - if (scope.engine->hasException) { - scope.engine->catchException(); - return Encode::undefined(); - } - return result->asReturnedValue(); -} |