diff options
author | Simon Hausmann <simon.hausmann@qt.io> | 2018-08-08 17:49:59 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@qt.io> | 2018-08-10 20:33:59 +0000 |
commit | e839129b6020795483d1f9ba0b3bcfde9f881bab (patch) | |
tree | 6b04478a2077d939635e70971720bcc0643ddbb1 /src/qml/compiler/qv4compilercontext.cpp | |
parent | 0bd3c9cda678b7e158c6142c1567ac927fde18b9 (diff) |
Fix support for default exports in modules
Default export declarations require a binding setup step at run-time, so
we hook it into the ESModule's statement list to make it visible to the
code gen visitor.
We also reserve local slot zero for the default export.
Change-Id: Ie064caad0422b92cfdadbd7d94db72a05e95c0cc
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/qml/compiler/qv4compilercontext.cpp')
-rw-r--r-- | src/qml/compiler/qv4compilercontext.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/qml/compiler/qv4compilercontext.cpp b/src/qml/compiler/qv4compilercontext.cpp index 77ac703ee3..c0fbb72c59 100644 --- a/src/qml/compiler/qv4compilercontext.cpp +++ b/src/qml/compiler/qv4compilercontext.cpp @@ -295,6 +295,11 @@ void Context::setupFunctionIndices(Moth::BytecodeGenerator *bytecodeGenerator) Q_ASSERT(nRegisters == 0); registerOffset = bytecodeGenerator->currentRegister(); + if (contextType == ContextType::ESModule && hasDefaultExport) { + // allocate a local slot for the default export + locals.append(QStringLiteral("*default*")); + } + switch (contextType) { case ContextType::ESModule: case ContextType::Block: |