aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/compiler/qv4compilercontext.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2018-09-03 09:31:47 +0200
committerLars Knoll <lars.knoll@qt.io>2018-09-05 12:57:41 +0000
commitfa74444ed06e4db21b0e9829a5832b886b39d372 (patch)
tree0bc352c539e164f15ccfe7fbb1db1dd7226a5bec /src/qml/compiler/qv4compilercontext.cpp
parent76f410452dd09489cc48197a0dd4d0bf95699647 (diff)
fix accesses to this in arrow functions
Change-Id: I4c0cfc3a120fc0b246760886b576e92d3f7623ff Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/compiler/qv4compilercontext.cpp')
-rw-r--r--src/qml/compiler/qv4compilercontext.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/qml/compiler/qv4compilercontext.cpp b/src/qml/compiler/qv4compilercontext.cpp
index 4ee6d2c179..1b4c084ab4 100644
--- a/src/qml/compiler/qv4compilercontext.cpp
+++ b/src/qml/compiler/qv4compilercontext.cpp
@@ -241,6 +241,13 @@ void Context::emitBlockHeader(Codegen *codegen)
Instruction::ConvertThisToObject convert;
bytecodeGenerator->addInstruction(convert);
}
+ if (innerFunctionAccessesThis) {
+ Instruction::LoadReg load;
+ load.reg = CallData::This;
+ bytecodeGenerator->addInstruction(load);
+ Codegen::Reference r = codegen->referenceForName(QStringLiteral("this"), true);
+ r.storeConsumeAccumulator();
+ }
if (contextType == ContextType::Global || (contextType == ContextType::Eval && !isStrict)) {
// variables in global code are properties of the global context object, not locals as with other functions.