aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/compiler/qv4compilerscanfunctions.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2018-08-31 15:09:36 +0200
committerLars Knoll <lars.knoll@qt.io>2018-09-04 18:24:59 +0000
commit367adf6666c47cb4e1ee7b299f69b4d7da8823ee (patch)
treef5272702551c0b5b5b2aa82ab7528afda533759b /src/qml/compiler/qv4compilerscanfunctions.cpp
parentbe158e67b60121342164a9db47f51f6c95c40e9a (diff)
Fix accessing of arguments inside eval and arrow functions
Change-Id: I1df6389a1fa6f1c3fc257df3075cea0c0af6a9cf Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/compiler/qv4compilerscanfunctions.cpp')
-rw-r--r--src/qml/compiler/qv4compilerscanfunctions.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/qml/compiler/qv4compilerscanfunctions.cpp b/src/qml/compiler/qv4compilerscanfunctions.cpp
index 5d3a7a6d8c..349bd08dcf 100644
--- a/src/qml/compiler/qv4compilerscanfunctions.cpp
+++ b/src/qml/compiler/qv4compilerscanfunctions.cpp
@@ -656,13 +656,16 @@ void ScanFunctions::calcEscapingVariables()
Module *m = _cg->_module;
for (Context *inner : qAsConst(m->contextMap)) {
- if (inner->contextType == ContextType::Block && inner->usesArgumentsObject == Context::ArgumentsObjectUsed) {
- Context *c = inner->parent;
- while (c->contextType == ContextType::Block)
- c = c->parent;
+ if (inner->usesArgumentsObject != Context::ArgumentsObjectUsed)
+ continue;
+ if (inner->contextType != ContextType::Block && !inner->isArrowFunction)
+ continue;
+ Context *c = inner->parent;
+ while (c && (c->contextType == ContextType::Block || c->isArrowFunction))
+ c = c->parent;
+ if (c)
c->usesArgumentsObject = Context::ArgumentsObjectUsed;
- inner->usesArgumentsObject = Context::ArgumentsObjectNotUsed;
- }
+ inner->usesArgumentsObject = Context::ArgumentsObjectNotUsed;
}
for (Context *inner : qAsConst(m->contextMap)) {
if (!inner->parent || inner->usesArgumentsObject == Context::ArgumentsObjectUnknown)