diff options
author | Lars Knoll <lars.knoll@qt.io> | 2018-09-04 14:49:49 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2018-09-07 10:31:45 +0000 |
commit | ee3d935a8b45576a237c74fd453fb0810f30f574 (patch) | |
tree | 4de5e0829d6159f9020f8abd549f59fce94a6236 /src/qml/compiler/qv4compilercontext.cpp | |
parent | d71df8db162ff8b4d6bd1833c088024b8870b02c (diff) |
Fix new.target access from eval()
Change-Id: I1855eb303225d1784b019f8eebab0ad8bf2cdf5e
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 1b4c084ab4..551467f95c 100644 --- a/src/qml/compiler/qv4compilercontext.cpp +++ b/src/qml/compiler/qv4compilercontext.cpp @@ -248,6 +248,13 @@ void Context::emitBlockHeader(Codegen *codegen) Codegen::Reference r = codegen->referenceForName(QStringLiteral("this"), true); r.storeConsumeAccumulator(); } + if (innerFunctionAccessesNewTarget) { + Instruction::LoadReg load; + load.reg = CallData::NewTarget; + bytecodeGenerator->addInstruction(load); + Codegen::Reference r = codegen->referenceForName(QStringLiteral("new.target"), 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. |