diff options
author | Lars Knoll <lars.knoll@qt.io> | 2018-04-13 23:13:02 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2018-05-02 14:19:05 +0000 |
commit | 10b127b620f983478e656188bbcf7246afb7cb39 (patch) | |
tree | e8b5a3f9472da38d22cfed43797414b7cf9af953 /src/qml/compiler/qv4compilerscanfunctions.cpp | |
parent | 5715732755b9bd36d5b6d14c5294e693c4d09ca8 (diff) |
Fix sanity checks when declaring variables
Change-Id: Ib2968d4da22eab06b8a82eb7697d5e9fce6dc43d
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/compiler/qv4compilerscanfunctions.cpp')
-rw-r--r-- | src/qml/compiler/qv4compilerscanfunctions.cpp | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/src/qml/compiler/qv4compilerscanfunctions.cpp b/src/qml/compiler/qv4compilerscanfunctions.cpp index 40459b3b28..47329e978b 100644 --- a/src/qml/compiler/qv4compilerscanfunctions.cpp +++ b/src/qml/compiler/qv4compilerscanfunctions.cpp @@ -209,15 +209,8 @@ bool ScanFunctions::visit(PatternElement *ast) _cg->throwSyntaxError(ast->identifierToken, QStringLiteral("Missing initializer in const declaration")); return false; } - const Context::Member *m = nullptr; - if (_context->memberInfo(name, &m)) { - if (m->isLexicallyScoped() || ast->isLexicallyScoped()) { - _cg->throwSyntaxError(ast->identifierToken, QStringLiteral("Identifier %1 has already been declared").arg(name)); - return false; - } - } if (!_context->addLocalVar(name, ast->initializer ? Context::VariableDefinition : Context::VariableDeclaration, ast->scope)) { - _cg->throwSyntaxError(ast->identifierToken, QStringLiteral("Identifier %1 has already been declared").arg(ast->bindingIdentifier)); + _cg->throwSyntaxError(ast->identifierToken, QStringLiteral("Identifier %1 has already been declared").arg(name)); return false; } } |