aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/compiler/qv4compilercontrolflow_p.h
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2018-05-08 14:34:58 +0200
committerLars Knoll <lars.knoll@qt.io>2018-05-11 07:17:12 +0000
commit01a1ad296c2b8325476abd6d28c8cc2463c42eb6 (patch)
tree4acaaf72782e634615e74c2da52227206cd16a42 /src/qml/compiler/qv4compilercontrolflow_p.h
parent4cf7e80c5740912804383e4d866ba12b2520d0e6 (diff)
Support destructuring inside catch()
Change-Id: Ib60b56ac6a7111446e01235564a4cf92ad8ad025 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/compiler/qv4compilercontrolflow_p.h')
-rw-r--r--src/qml/compiler/qv4compilercontrolflow_p.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/qml/compiler/qv4compilercontrolflow_p.h b/src/qml/compiler/qv4compilercontrolflow_p.h
index b89226c411..db83af0022 100644
--- a/src/qml/compiler/qv4compilercontrolflow_p.h
+++ b/src/qml/compiler/qv4compilercontrolflow_p.h
@@ -422,6 +422,10 @@ struct ControlFlowCatch : public ControlFlowUnwind
Reference::storeConstOnStack(cg, QV4::Encode::undefined(), controlFlowTemp);
generator()->setExceptionHandler(&catchUnwindLabel);
+ if (catchExpression->patternElement->bindingIdentifier.isEmpty())
+ // destructuring pattern
+ cg->initializeAndDestructureBindingElement(catchExpression->patternElement, Reference::fromName(cg, QStringLiteral("@caught")));
+ // skip the additional block
cg->statementList(catchExpression->statement->statements);
insideCatch = false;