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_p.h | |
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_p.h')
-rw-r--r-- | src/qml/jsruntime/qv4script_p.h | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/qml/jsruntime/qv4script_p.h b/src/qml/jsruntime/qv4script_p.h index c138e4a538..a1e9b83a8b 100644 --- a/src/qml/jsruntime/qv4script_p.h +++ b/src/qml/jsruntime/qv4script_p.h @@ -73,10 +73,10 @@ struct Q_QML_EXPORT Script { : sourceFile(source), line(line), column(column), sourceCode(sourceCode) , context(scope), strictMode(false), inheritContext(false), parsed(false), contextType(mode) , vmFunction(nullptr), parseAsBinding(false) {} - Script(ExecutionEngine *engine, QmlContext *qml, const QString &sourceCode, const QString &source = QString(), int line = 1, int column = 0) + Script(ExecutionEngine *engine, QmlContext *qml, bool parseAsBinding, const QString &sourceCode, const QString &source = QString(), int line = 1, int column = 0) : sourceFile(source), line(line), column(column), sourceCode(sourceCode) , context(engine->rootContext()), strictMode(false), inheritContext(true), parsed(false) - , vmFunction(nullptr), parseAsBinding(true) { + , vmFunction(nullptr), parseAsBinding(parseAsBinding) { if (qml) qmlContext.set(engine, *qml); } @@ -106,8 +106,6 @@ struct Q_QML_EXPORT Script { QList<QQmlError> *reportedErrors = nullptr, QV4::Compiler::ContextType contextType = QV4::Compiler::ContextType::Global); static Script *createFromFileOrCache(ExecutionEngine *engine, QmlContext *qmlContext, const QString &fileName, const QUrl &originalUrl, QString *error); - - static ReturnedValue evaluate(ExecutionEngine *engine, const QString &script, QmlContext *qmlContext); }; } |