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/qv4codegen.cpp | |
parent | 76f410452dd09489cc48197a0dd4d0bf95699647 (diff) | |
download | qtdeclarative-fa74444ed06e4db21b0e9829a5832b886b39d372.tar.gz |
fix accesses to this in arrow functions
Change-Id: I4c0cfc3a120fc0b246760886b576e92d3f7623ff
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/compiler/qv4codegen.cpp')
-rw-r--r-- | src/qml/compiler/qv4codegen.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/qml/compiler/qv4codegen.cpp b/src/qml/compiler/qv4codegen.cpp index 786753ab80..d61f79f0fc 100644 --- a/src/qml/compiler/qv4codegen.cpp +++ b/src/qml/compiler/qv4codegen.cpp @@ -2717,6 +2717,12 @@ bool Codegen::visit(ThisExpression *) if (hasError) return false; + if (_context->isArrowFunction) { + Reference r = referenceForName(QStringLiteral("this"), false); + r.isReadonly = true; + _expr.setResult(r); + return false; + } _expr.setResult(Reference::fromThis(this)); return false; } |