diff options
author | Simon Hausmann <simon.hausmann@qt.io> | 2018-09-20 10:48:33 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@qt.io> | 2018-09-23 20:27:40 +0000 |
commit | 6146021eb72a0aca5cc635b577b5e43b60824bc8 (patch) | |
tree | bbca3e8d57d763692a5418f19a587c2a01baf4d9 /src/qml/compiler/qv4compilercontext.cpp | |
parent | a97d118bf55e1c44ded9bbcd143b0f0725db8268 (diff) |
Fix use of lexically scoped variables in modules
Their use may trigger setting c->requiresExecutionContext on the module
context, which is correct. However, unlike functions, modules at
instantiation time always have their context created ahead of time (to
populate imports). Therefore we must not emit call context creating byte
code instructions where we'd end up storing exports in the wrong place.
Change-Id: Id1264f1cfa6a7f1cd94247ffe71938bc9c5c3ff9
Fixes: QTBUG-70632
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/qml/compiler/qv4compilercontext.cpp')
-rw-r--r-- | src/qml/compiler/qv4compilercontext.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/qml/compiler/qv4compilercontext.cpp b/src/qml/compiler/qv4compilercontext.cpp index 551467f95c..b423dcf0b7 100644 --- a/src/qml/compiler/qv4compilercontext.cpp +++ b/src/qml/compiler/qv4compilercontext.cpp @@ -222,7 +222,7 @@ void Context::emitBlockHeader(Codegen *codegen) blockContext.index = blockIndex; bytecodeGenerator->addInstruction(blockContext); } - } else { + } else if (contextType != ContextType::ESModule) { Instruction::CreateCallContext createContext; bytecodeGenerator->addInstruction(createContext); } @@ -318,7 +318,7 @@ QT_WARNING_PUSH QT_WARNING_DISABLE_GCC("-Wmaybe-uninitialized") // the loads below are empty structs. if (contextType == ContextType::Global) bytecodeGenerator->addInstruction(Instruction::PopScriptContext()); - else + else if (contextType != ContextType::ESModule) bytecodeGenerator->addInstruction(Instruction::PopContext()); QT_WARNING_POP } |