diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/qml/compiler/qv4compilerscanfunctions.cpp | 2 | ||||
-rw-r--r-- | src/qml/parser/qqmljs.g | 1 |
2 files changed, 1 insertions, 2 deletions
diff --git a/src/qml/compiler/qv4compilerscanfunctions.cpp b/src/qml/compiler/qv4compilerscanfunctions.cpp index 639728df52..68cb58da46 100644 --- a/src/qml/compiler/qv4compilerscanfunctions.cpp +++ b/src/qml/compiler/qv4compilerscanfunctions.cpp @@ -177,7 +177,7 @@ bool ScanFunctions::visit(PatternElement *ast) checkName(QStringRef(&name), ast->identifierToken); if (name == QLatin1String("arguments")) _context->usesArgumentsObject = Context::ArgumentsObjectNotUsed; - if (ast->scope == VariableScope::Const && !ast->initializer) { + if (ast->scope == VariableScope::Const && !ast->initializer && !ast->destructuringPattern()) { _cg->throwSyntaxError(ast->identifierToken, QStringLiteral("Missing initializer in const declaration")); return false; } diff --git a/src/qml/parser/qqmljs.g b/src/qml/parser/qqmljs.g index f927473e53..7928881d8c 100644 --- a/src/qml/parser/qqmljs.g +++ b/src/qml/parser/qqmljs.g @@ -3209,7 +3209,6 @@ ForDeclaration: Var BindingPattern; /. case $rule_number: { auto *node = new (pool) AST::PatternElement(sym(2).Pattern, nullptr); - node->identifierToken = loc(2); node->scope = sym(1).scope; sym(1).Node = node; } break; |