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/compiler/qv4compilerscanfunctions.cpp | |
parent | 17f72f2d07352940b67a60c2ff6f7ef848793488 (diff) | |
download | qtdeclarative-e9492e7b7b44c1f8cd5489d93463fc2b1f8b6d72.tar.gz |
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/compiler/qv4compilerscanfunctions.cpp')
-rw-r--r-- | src/qml/compiler/qv4compilerscanfunctions.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/qml/compiler/qv4compilerscanfunctions.cpp b/src/qml/compiler/qv4compilerscanfunctions.cpp index 3bbef3a96a..b779e37946 100644 --- a/src/qml/compiler/qv4compilerscanfunctions.cpp +++ b/src/qml/compiler/qv4compilerscanfunctions.cpp @@ -56,12 +56,12 @@ using namespace QV4; using namespace QV4::Compiler; using namespace QQmlJS::AST; -ScanFunctions::ScanFunctions(Codegen *cg, const QString &sourceCode, CompilationMode defaultProgramMode) +ScanFunctions::ScanFunctions(Codegen *cg, const QString &sourceCode, ContextType defaultProgramType) : _cg(cg) , _sourceCode(sourceCode) , _context(nullptr) , _allowFuncDecls(true) - , defaultProgramMode(defaultProgramMode) + , defaultProgramType(defaultProgramType) { } @@ -73,12 +73,12 @@ void ScanFunctions::operator()(Node *node) calcEscapingVariables(); } -void ScanFunctions::enterGlobalEnvironment(CompilationMode compilationMode) +void ScanFunctions::enterGlobalEnvironment(ContextType compilationMode) { enterEnvironment(astNodeForGlobalEnvironment, compilationMode); } -void ScanFunctions::enterEnvironment(Node *node, CompilationMode compilationMode) +void ScanFunctions::enterEnvironment(Node *node, ContextType compilationMode) { Context *c = _cg->_module->contextMap.value(node); if (!c) @@ -138,7 +138,7 @@ void ScanFunctions::checkName(const QStringRef &name, const SourceLocation &loc) bool ScanFunctions::visit(Program *ast) { - enterEnvironment(ast, defaultProgramMode); + enterEnvironment(ast, defaultProgramType); checkDirectivePrologue(ast->statements); return true; } @@ -392,7 +392,8 @@ bool ScanFunctions::visit(ThisExpression *) return false; } -bool ScanFunctions::visit(Block *ast) { +bool ScanFunctions::visit(Block *ast) +{ TemporaryBoolAssignment allowFuncDecls(_allowFuncDecls, _context->isStrict ? false : _allowFuncDecls); Node::accept(ast->statements, this); return false; @@ -401,7 +402,7 @@ bool ScanFunctions::visit(Block *ast) { bool ScanFunctions::enterFunction(Node *ast, const QString &name, FormalParameterList *formals, StatementList *body, bool enterName) { Context *outerContext = _context; - enterEnvironment(ast, FunctionCode); + enterEnvironment(ast, ContextType::Function); FunctionExpression *expr = AST::cast<FunctionExpression *>(ast); if (!expr) |