diff options
Diffstat (limited to 'src/qml/compiler/qv4compilercontext.cpp')
-rw-r--r-- | src/qml/compiler/qv4compilercontext.cpp | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/qml/compiler/qv4compilercontext.cpp b/src/qml/compiler/qv4compilercontext.cpp index ba9b270601..4ee6d2c179 100644 --- a/src/qml/compiler/qv4compilercontext.cpp +++ b/src/qml/compiler/qv4compilercontext.cpp @@ -321,14 +321,6 @@ void Context::setupFunctionIndices(Moth::BytecodeGenerator *bytecodeGenerator) Q_ASSERT(nRegisters == 0); registerOffset = bytecodeGenerator->currentRegister(); - if (contextType == ContextType::ESModule && !localNameForDefaultExport.isEmpty()) { - if (!members.contains(localNameForDefaultExport)) { - // allocate a local slot for the default export, to be used in - // CodeGen::visit(ExportDeclaration*). - locals.append(localNameForDefaultExport); - } - } - QVector<Context::MemberMap::Iterator> localsInTDZ; const auto registerLocal = [this, &localsInTDZ](Context::MemberMap::iterator member) { if (member->isLexicallyScoped()) { @@ -383,6 +375,15 @@ void Context::setupFunctionIndices(Moth::BytecodeGenerator *bytecodeGenerator) locals.append(member.key()); } + if (contextType == ContextType::ESModule && !localNameForDefaultExport.isEmpty()) { + if (!members.contains(localNameForDefaultExport)) { + // allocate a local slot for the default export, to be used in + // CodeGen::visit(ExportDeclaration*). + locals.append(localNameForDefaultExport); + ++sizeOfLocalTemporalDeadZone; + } + } + sizeOfRegisterTemporalDeadZone = registersInTDZ.count(); firstTemporalDeadZoneRegister = bytecodeGenerator->currentRegister(); for (auto &member: qAsConst(registersInTDZ)) |