diff options
author | Lars Knoll <lars.knoll@qt.io> | 2018-04-19 21:27:28 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2018-04-27 08:11:32 +0000 |
commit | 851b8fe905ff2f3fe5c5199fdbcb930201d52b87 (patch) | |
tree | be7e68febe1ecf5df960177a78f5aefc44478dbe /src/qml/compiler/qv4compilercontext_p.h | |
parent | 02252ae08dc36ba44f65fb932c428849c7369299 (diff) |
Use a PatternElement for VariableDeclarations
Required to get proper destructuring working.
Change-Id: I99fc20a9f1bace1fe3981d88ce5466f9c8d98245
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/compiler/qv4compilercontext_p.h')
-rw-r--r-- | src/qml/compiler/qv4compilercontext_p.h | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/qml/compiler/qv4compilercontext_p.h b/src/qml/compiler/qv4compilercontext_p.h index 9ce0d5fa1e..e53fb26e4a 100644 --- a/src/qml/compiler/qv4compilercontext_p.h +++ b/src/qml/compiler/qv4compilercontext_p.h @@ -118,11 +118,11 @@ struct Context { struct Member { MemberType type = UndefinedMember; int index = -1; - QQmlJS::AST::VariableDeclaration::VariableScope scope = QQmlJS::AST::VariableDeclaration::FunctionScope; + QQmlJS::AST::VariableScope scope = QQmlJS::AST::VariableScope::Var; mutable bool canEscape = false; QQmlJS::AST::FunctionExpression *function = nullptr; - bool isLexicallyScoped() const { return this->scope != QQmlJS::AST::VariableDeclaration::FunctionScope; } + bool isLexicallyScoped() const { return this->scope != QQmlJS::AST::VariableScope::Var; } }; typedef QMap<QString, Member> MemberMap; @@ -259,18 +259,18 @@ struct Context { usedVariables.insert(name); } - bool addLocalVar(const QString &name, MemberType type, QQmlJS::AST::VariableDeclaration::VariableScope scope, QQmlJS::AST::FunctionExpression *function = nullptr) + bool addLocalVar(const QString &name, MemberType type, QQmlJS::AST::VariableScope scope, QQmlJS::AST::FunctionExpression *function = nullptr) { if (name.isEmpty()) return true; if (type != FunctionDefinition) { if (formals->containsName(name)) - return (scope == QQmlJS::AST::VariableDeclaration::FunctionScope); + return (scope == QQmlJS::AST::VariableScope::Var); } MemberMap::iterator it = members.find(name); if (it != members.end()) { - if (scope != QQmlJS::AST::VariableDeclaration::FunctionScope || (*it).scope != QQmlJS::AST::VariableDeclaration::FunctionScope) + if (scope != QQmlJS::AST::VariableScope::Var || (*it).scope != QQmlJS::AST::VariableScope::Var) return false; if ((*it).type <= type) { (*it).type = type; |