aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/qml/parser/qqmljs.g7
-rw-r--r--src/qml/parser/qqmljsast_p.h9
2 files changed, 8 insertions, 8 deletions
diff --git a/src/qml/parser/qqmljs.g b/src/qml/parser/qqmljs.g
index f1d62badc3..b9697a726f 100644
--- a/src/qml/parser/qqmljs.g
+++ b/src/qml/parser/qqmljs.g
@@ -2810,8 +2810,7 @@ VariableDeclaration: BindingIdentifier InitializerOpt;
VariableDeclaration_In: BindingIdentifier InitializerOpt_In;
/.
case $rule_number: {
- AST::VariableDeclaration::VariableScope s = AST::VariableDeclaration::FunctionScope;
- AST::VariableDeclaration *node = new (pool) AST::VariableDeclaration(stringRef(1), sym(2).Expression, s);
+ AST::VariableDeclaration *node = new (pool) AST::VariableDeclaration(stringRef(1), sym(2).Expression);
node->identifierToken = loc(1);
sym(1).Node = node;
} break;
@@ -3131,8 +3130,8 @@ ForDeclaration: LetOrConst ForBinding;
ForDeclaration: Var ForBinding;
/.
case $rule_number: {
- AST::VariableDeclaration::VariableScope s = AST::VariableDeclaration::VariableScope(sym(1).ival);
- auto *node = new (pool) AST::VariableDeclaration(stringRef(2), nullptr, s);
+ AST::VariableDeclaration *node = new (pool) AST::VariableDeclaration(stringRef(2), nullptr);
+ node->scope = AST::VariableDeclaration::VariableScope(sym(1).ival);
node->identifierToken = loc(2);
sym(1).Node = node;
} break;
diff --git a/src/qml/parser/qqmljsast_p.h b/src/qml/parser/qqmljsast_p.h
index 8e25924a8d..21e27de5ac 100644
--- a/src/qml/parser/qqmljsast_p.h
+++ b/src/qml/parser/qqmljsast_p.h
@@ -1400,14 +1400,15 @@ public:
QQMLJS_DECLARE_AST_NODE(VariableDeclaration)
enum VariableScope {
+ UnknownScope,
FunctionScope,
BlockScope, // let
ReadOnlyBlockScope // const
};
- VariableDeclaration(const QStringRef &n, ExpressionNode *e, VariableScope s):
- name (n), expression (e), scope(s)
- { kind = K; }
+ VariableDeclaration(const QStringRef &n, ExpressionNode *e)
+ : name(n), expression(e)
+ { kind = K; }
bool isLexicallyScoped() const { return scope != FunctionScope; }
@@ -1423,7 +1424,7 @@ public:
QStringRef name;
ExpressionNode *expression;
SourceLocation identifierToken;
- VariableScope scope;
+ VariableScope scope = UnknownScope;
};
class QML_PARSER_EXPORT VariableDeclarationList: public Node