diff options
-rw-r--r-- | src/qml/compiler/qv4codegen.cpp | 5 | ||||
-rw-r--r-- | tests/auto/qml/v4misc/tst_v4misc.cpp | 1 |
2 files changed, 5 insertions, 1 deletions
diff --git a/src/qml/compiler/qv4codegen.cpp b/src/qml/compiler/qv4codegen.cpp index 8ff8ab7993..e55f4022d6 100644 --- a/src/qml/compiler/qv4codegen.cpp +++ b/src/qml/compiler/qv4codegen.cpp @@ -1318,7 +1318,10 @@ bool Codegen::visit(BinaryExpression *ast) } else if (ast->op == QSOperator::Assign) { if (AST::Pattern *p = ast->left->patternCast()) { RegisterScope scope(this); - Reference right = expression(ast->right).storeOnStack(); + Reference right = expression(ast->right); + if (hasError) + return false; + right = right.storeOnStack(); destructurePattern(p, right); if (!_expr.accept(nx)) { right.loadInAccumulator(); diff --git a/tests/auto/qml/v4misc/tst_v4misc.cpp b/tests/auto/qml/v4misc/tst_v4misc.cpp index ff04be523b..f8e76fdf5c 100644 --- a/tests/auto/qml/v4misc/tst_v4misc.cpp +++ b/tests/auto/qml/v4misc/tst_v4misc.cpp @@ -113,6 +113,7 @@ void tst_v4misc::parserMisc_data() QTest::newRow("`a${1++}`") << QString("ReferenceError: Invalid left-hand side expression in postfix operation"); QTest::newRow("for (var f in ++!binaryMathg) ;") << QString("ReferenceError: Prefix ++ operator applied to value that is not a reference."); QTest::newRow("for (va() in obj) {}") << QString("ReferenceError: Invalid left-hand side expression for 'in' expression"); + QTest::newRow("[1]=7[A=8=9]") << QString("ReferenceError: left-hand side of assignment operator is not an lvalue"); } void tst_v4misc::parserMisc() |