aboutsummaryrefslogtreecommitdiffstats
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
parentbe158e67b60121342164a9db47f51f6c95c40e9a (diff)
Fix accessing of arguments inside eval and arrow functions
Change-Id: I1df6389a1fa6f1c3fc257df3075cea0c0af6a9cf Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
-rw-r--r--src/qml/compiler/qv4compilerscanfunctions.cpp15
-rw-r--r--tests/auto/qml/ecmascripttests/TestExpectations1
2 files changed, 9 insertions, 7 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)
diff --git a/tests/auto/qml/ecmascripttests/TestExpectations b/tests/auto/qml/ecmascripttests/TestExpectations
index bcb6729ab6..afefb5fa26 100644
--- a/tests/auto/qml/ecmascripttests/TestExpectations
+++ b/tests/auto/qml/ecmascripttests/TestExpectations
@@ -664,7 +664,6 @@ language/eval-code/indirect/var-env-var-non-strict.js strictFails
language/expressions/arrow-function/cannot-override-this-with-thisArg.js fails
language/expressions/arrow-function/dflt-params-ref-later.js fails
language/expressions/arrow-function/dflt-params-ref-self.js fails
-language/expressions/arrow-function/lexical-arguments.js fails
language/expressions/arrow-function/lexical-new.target-closure-returned.js fails
language/expressions/arrow-function/lexical-new.target.js fails
language/expressions/arrow-function/lexical-super-call-from-within-constructor.js fails