diff options
author | Lars Knoll <lars.knoll@qt.io> | 2018-04-16 10:51:29 +0200 |
---|---|---|
committer | Aapo Keskimolo <aapo.keskimolo@qt.io> | 2018-04-16 17:52:18 +0000 |
commit | 685a267d37b5a13ed357d6c03953096d6b88907b (patch) | |
tree | 05666aafd1ce0261d16fba733eec69138e7c38d5 /src/qml/compiler/qv4codegen.cpp | |
parent | 2e6196f727cbc5c23be8d264e160933b283cb459 (diff) |
Fix crashes when parsing destructuring expressions
x = [y] = z
would crash because [y] is a literal and not a valid lvalue
in ES5, something our parser didn't catch correctly.
Change-Id: I0d7abd9b3f812f1de61c77dccfab5d1778dac793
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/compiler/qv4codegen.cpp')
-rw-r--r-- | src/qml/compiler/qv4codegen.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/qml/compiler/qv4codegen.cpp b/src/qml/compiler/qv4codegen.cpp index a262908960..8ada1d505e 100644 --- a/src/qml/compiler/qv4codegen.cpp +++ b/src/qml/compiler/qv4codegen.cpp @@ -784,9 +784,10 @@ bool Codegen::visit(BinaryExpression *ast) left = left.asLValue(); if (throwSyntaxErrorOnEvalOrArgumentsInStrictMode(left, ast->left->lastSourceLocation())) return false; - expression(ast->right).loadInAccumulator(); + Reference r = expression(ast->right); if (hasError) return false; + r.loadInAccumulator(); if (_expr.accept(nx)) _expr.setResult(left.storeConsumeAccumulator()); else |