aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2018-03-21 11:23:43 +0100
committerLars Knoll <lars.knoll@qt.io>2018-04-27 08:10:51 +0000
commit0de2ac924a3dbbd59b9e726f470113e4c87b0ae7 (patch)
tree9f2b9d8e83c303498cb6b879102a0cb6512797b1 /src
parent602073631e73f8be3933e9500cb81170b2f4c1c0 (diff)
smaller cleanup
The VariableDeclaration constructor shouldn't specify the scope of the declared variable. Change-Id: I1368cec7c5cb8535e169c0fc20d3be4e69368b47 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src')
-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