diff options
author | Lars Knoll <lars.knoll@qt.io> | 2018-06-06 09:02:53 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2018-06-21 13:30:53 +0000 |
commit | 77cb60e0c071f9762f565f1f38859421c928dd4a (patch) | |
tree | 5e42f0989bf3908beeccc3fe122302f8367f9b8f /src/qml/compiler/qv4compilerscanfunctions.cpp | |
parent | 45d39a1685e72975dd9bd4d3e4a67aab59eeae48 (diff) |
Fix const expressions containing destructuring patterns
Don't throw a syntax error when encountering a destructuring
pattern.
Change-Id: I93250a2963d2d50ff61d725229e1b51be17689e9
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/compiler/qv4compilerscanfunctions.cpp')
-rw-r--r-- | src/qml/compiler/qv4compilerscanfunctions.cpp | 2 |
1 files changed, 1 insertions, 1 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; } |