summaryrefslogtreecommitdiff
path: root/src/qml/compiler/qv4codegen.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2018-09-06 13:38:23 +0200
committerLars Knoll <lars.knoll@qt.io>2018-09-07 10:31:57 +0000
commitbd4064eabf79a6166805c877ee622931df6fb172 (patch)
tree9a9d96fbb224ada879836dbfb7cff9e93b44946f /src/qml/compiler/qv4codegen.cpp
parent15bdbd89639c29f88db1798de66066a4a95759c0 (diff)
downloadqtdeclarative-bd4064eabf79a6166805c877ee622931df6fb172.tar.gz
Throw a type error when trying to destructure null or undefined
Change-Id: Id1bba1a729124bccb8a90dcf40252fe5c69d27a3 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/compiler/qv4codegen.cpp')
-rw-r--r--src/qml/compiler/qv4codegen.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/qml/compiler/qv4codegen.cpp b/src/qml/compiler/qv4codegen.cpp
index 1d6e8819f5..2415142df4 100644
--- a/src/qml/compiler/qv4codegen.cpp
+++ b/src/qml/compiler/qv4codegen.cpp
@@ -619,6 +619,10 @@ void Codegen::destructurePropertyList(const Codegen::Reference &object, PatternP
{
RegisterScope scope(this);
+ object.loadInAccumulator();
+ Instruction::ThrowOnNullOrUndefined t;
+ bytecodeGenerator->addInstruction(t);
+
for (PatternPropertyList *it = bindingList; it; it = it->next) {
PatternProperty *p = it->property;
RegisterScope scope(this);