From a0a702cd9a315946a1b35dfe54d2dc965210ab6e Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Fri, 31 Aug 2018 16:47:17 +0200 Subject: Always generate a context if an inner function uses super Change-Id: I4215c215a28da6855d946dec8727c0c4f0acb933 Reviewed-by: Simon Hausmann --- src/qml/compiler/qv4compilerscanfunctions.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/qml/compiler/qv4compilerscanfunctions.cpp') 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"))) -- cgit v1.2.3