diff options
Diffstat (limited to 'src/qml/compiler/qv4codegen.cpp')
| -rw-r--r-- | src/qml/compiler/qv4codegen.cpp | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/qml/compiler/qv4codegen.cpp b/src/qml/compiler/qv4codegen.cpp index 4e6d56adcf..a4d00ce37b 100644 --- a/src/qml/compiler/qv4codegen.cpp +++ b/src/qml/compiler/qv4codegen.cpp @@ -397,18 +397,27 @@ void Codegen::initializeAndDestructureBindingElement(AST::PatternElement *e, con if (e->initializer) { if (!baseRef.isValid()) { // assignment - expression(e->initializer).loadInAccumulator(); + Reference expr = expression(e->initializer); + if (hasError) + return; + expr.loadInAccumulator(); varToStore.storeConsumeAccumulator(); } else if (baseRef == varToStore) { baseRef.loadInAccumulator(); BytecodeGenerator::Jump jump = bytecodeGenerator->jumpNotUndefined(); - expression(e->initializer).loadInAccumulator(); + Reference expr = expression(e->initializer); + if (hasError) + return; + expr.loadInAccumulator(); varToStore.storeConsumeAccumulator(); jump.link(); } else { baseRef.loadInAccumulator(); BytecodeGenerator::Jump jump = bytecodeGenerator->jumpNotUndefined(); - expression(e->initializer).loadInAccumulator(); + Reference expr = expression(e->initializer); + if (hasError) + return; + expr.loadInAccumulator(); jump.link(); varToStore.storeConsumeAccumulator(); } @@ -2033,6 +2042,7 @@ bool Codegen::visit(ObjectPattern *ast) if (!computedProperties.isEmpty()) { result = result.storeOnStack(); for (const auto &c : qAsConst(computedProperties)) { + // ### if RHS is an anonymous FunctionExpression, we need to set it's name to the computed name Reference element = Reference::fromSubscript(result, c.first); c.second.rvalue.loadInAccumulator(); element.storeConsumeAccumulator(); |
