aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2018-06-21 16:13:00 +0200
committerLars Knoll <lars.knoll@qt.io>2018-06-21 14:21:06 +0000
commitf44782d0cdbdb800d9c31d5aff712fbf29d52edc (patch)
tree8e4b1bd4a12377867a27a272e48ecc52c48f6c87 /src
parentaeb521054fdc070e3480f30c6595155075c10136 (diff)
Variables declared in strict eval code don't all escape
eval() calls in strict mode code create their own context, so even though we don't have a parent context, those variables do not escape, and can be allocated on the stack. Change-Id: Iea1853452fe1f792468fd6108851f04a1acf9b66 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/qml/compiler/qv4compilerscanfunctions.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/qml/compiler/qv4compilerscanfunctions.cpp b/src/qml/compiler/qv4compilerscanfunctions.cpp
index 68cb58da46..7506b238f8 100644
--- a/src/qml/compiler/qv4compilerscanfunctions.cpp
+++ b/src/qml/compiler/qv4compilerscanfunctions.cpp
@@ -554,7 +554,7 @@ void ScanFunctions::calcEscapingVariables()
for (Context *c : qAsConst(m->contextMap)) {
if (c->allVarsEscape && c->contextType == ContextType::Block && c->members.isEmpty())
c->allVarsEscape = false;
- if (!c->parent || m->debugMode)
+ if (c->contextType == ContextType::Global || (!c->isStrict && c->contextType == ContextType::Eval) || m->debugMode)
c->allVarsEscape = true;
if (c->allVarsEscape) {
if (c->parent) {