diff options
author | Lars Knoll <lars.knoll@qt.io> | 2018-09-03 09:31:47 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2018-09-05 12:57:41 +0000 |
commit | fa74444ed06e4db21b0e9829a5832b886b39d372 (patch) | |
tree | 0bc352c539e164f15ccfe7fbb1db1dd7226a5bec /src/qml/compiler/qv4compilercontext.cpp | |
parent | 76f410452dd09489cc48197a0dd4d0bf95699647 (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.cpp | 7 |
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. |