aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/compiler/qv4compilerscanfunctions.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2018-08-31 16:47:17 +0200
committerLars Knoll <lars.knoll@qt.io>2018-09-04 18:25:06 +0000
commita0a702cd9a315946a1b35dfe54d2dc965210ab6e (patch)
treecd383fe4bbe2dec3daccee659937af7fdcd850d6 /src/qml/compiler/qv4compilerscanfunctions.cpp
parent367adf6666c47cb4e1ee7b299f69b4d7da8823ee (diff)
Always generate a context if an inner function uses super
Change-Id: I4215c215a28da6855d946dec8727c0c4f0acb933 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/compiler/qv4compilerscanfunctions.cpp')
-rw-r--r--src/qml/compiler/qv4compilerscanfunctions.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/qml/compiler/qv4compilerscanfunctions.cpp b/src/qml/compiler/qv4compilerscanfunctions.cpp
index 349bd08dcf..e0a745ebb1 100644
--- a/src/qml/compiler/qv4compilerscanfunctions.cpp
+++ b/src/qml/compiler/qv4compilerscanfunctions.cpp
@@ -414,6 +414,17 @@ bool ScanFunctions::visit(TemplateLiteral *ast)
}
+bool ScanFunctions::visit(SuperLiteral *)
+{
+ Context *c = _context;
+ while (c && (c->contextType != ContextType::Function || c->isArrowFunction))
+ c = c->parent;
+
+ if (c)
+ c->requiresExecutionContext = true;
+
+ return false;
+}
bool ScanFunctions::enterFunction(FunctionExpression *ast, bool enterName)
{
if (_context->isStrict && (ast->name == QLatin1String("eval") || ast->name == QLatin1String("arguments")))