diff options
author | Lars Knoll <lars.knoll@qt.io> | 2018-03-26 21:32:05 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2018-05-02 14:17:13 +0000 |
commit | e9492e7b7b44c1f8cd5489d93463fc2b1f8b6d72 (patch) | |
tree | 01d8e52fe7841c91fd019219055796fcc8db22aa /src/qml/jsruntime | |
parent | 17f72f2d07352940b67a60c2ff6f7ef848793488 (diff) |
Rename the CompilationMode enum to ContextType
And make it an enum class. The new name fits better, as it's mainly
used to determine the type of the context when parsing. Also already
added the 'Block' value that will be needed.
Change-Id: I70d963b6a0b22db1a3c607cce6bdd2054b29e000
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/jsruntime')
-rw-r--r-- | src/qml/jsruntime/qv4globalobject.cpp | 2 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4runtimecodegen.cpp | 4 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4script.cpp | 4 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4script_p.h | 6 |
4 files changed, 8 insertions, 8 deletions
diff --git a/src/qml/jsruntime/qv4globalobject.cpp b/src/qml/jsruntime/qv4globalobject.cpp index f419ab53fe..b68f3db3cf 100644 --- a/src/qml/jsruntime/qv4globalobject.cpp +++ b/src/qml/jsruntime/qv4globalobject.cpp @@ -361,7 +361,7 @@ ReturnedValue EvalFunction::evalCall(const Value *, const Value *argv, int argc, const QString code = scode->toQString(); bool inheritContext = !isStrict; - Script script(ctx, QV4::Compiler::EvalCode, code, QStringLiteral("eval code")); + Script script(ctx, QV4::Compiler::ContextType::Eval, code, QStringLiteral("eval code")); script.strictMode = (directCall && isStrict); script.inheritContext = inheritContext; script.parse(); diff --git a/src/qml/jsruntime/qv4runtimecodegen.cpp b/src/qml/jsruntime/qv4runtimecodegen.cpp index 93ca666c53..b03dce49f3 100644 --- a/src/qml/jsruntime/qv4runtimecodegen.cpp +++ b/src/qml/jsruntime/qv4runtimecodegen.cpp @@ -52,9 +52,9 @@ void RuntimeCodegen::generateFromFunctionExpression(const QString &fileName, _module->finalUrl = fileName; _context = nullptr; - Compiler::ScanFunctions scan(this, sourceCode, Compiler::GlobalCode); + Compiler::ScanFunctions scan(this, sourceCode, Compiler::ContextType::Global); // fake a global environment - scan.enterEnvironment(nullptr, Compiler::FunctionCode); + scan.enterEnvironment(nullptr, Compiler::ContextType::Function); scan(ast); scan.leaveEnvironment(); diff --git a/src/qml/jsruntime/qv4script.cpp b/src/qml/jsruntime/qv4script.cpp index 01d6bfd368..daff1c659a 100644 --- a/src/qml/jsruntime/qv4script.cpp +++ b/src/qml/jsruntime/qv4script.cpp @@ -127,7 +127,7 @@ void Script::parse() RuntimeCodegen cg(v4, &jsGenerator, strictMode); if (inheritContext) cg.setUseFastLookups(false); - cg.generateFromProgram(sourceFile, sourceFile, sourceCode, program, &module, compilationMode); + cg.generateFromProgram(sourceFile, sourceFile, sourceCode, program, &module, contextType); if (v4->hasException) return; @@ -218,7 +218,7 @@ QQmlRefPointer<QV4::CompiledData::CompilationUnit> Script::precompile(QV4::Compi Codegen cg(unitGenerator, /*strict mode*/false); cg.setUseFastLookups(false); - cg.generateFromProgram(fileName, finalUrl, source, program, module, GlobalCode); + cg.generateFromProgram(fileName, finalUrl, source, program, module, ContextType::Global); errors = cg.qmlErrors(); if (!errors.isEmpty()) { if (reportedErrors) diff --git a/src/qml/jsruntime/qv4script_p.h b/src/qml/jsruntime/qv4script_p.h index c94b1d1a4f..0d1bce6f06 100644 --- a/src/qml/jsruntime/qv4script_p.h +++ b/src/qml/jsruntime/qv4script_p.h @@ -65,9 +65,9 @@ class QQmlContextData; namespace QV4 { struct Q_QML_EXPORT Script { - Script(ExecutionContext *scope, QV4::Compiler::CompilationMode mode, const QString &sourceCode, const QString &source = QString(), int line = 1, int column = 0) + Script(ExecutionContext *scope, QV4::Compiler::ContextType mode, const QString &sourceCode, const QString &source = QString(), int line = 1, int column = 0) : sourceFile(source), line(line), column(column), sourceCode(sourceCode) - , context(scope), strictMode(false), inheritContext(false), parsed(false), compilationMode(mode) + , 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) : sourceFile(source), line(line), column(column), sourceCode(sourceCode) @@ -86,7 +86,7 @@ struct Q_QML_EXPORT Script { bool strictMode; bool inheritContext; bool parsed; - QV4::Compiler::CompilationMode compilationMode = QV4::Compiler::EvalCode; + QV4::Compiler::ContextType contextType = QV4::Compiler::ContextType::Eval; QV4::PersistentValue qmlContext; QQmlRefPointer<CompiledData::CompilationUnit> compilationUnit; Function *vmFunction; |