QMLJS: Have ScanFunctions iterate over ArrayPattern nodes
Like Codegen, have ScanFunctions iterate over the elements in an ArrayPattern, instead of recursing over the tail of the element list. This prevents running out of (native) stack, or hitting the recursion check limiter. Change-Id: I8203af3119ad50f19000a215af42649d9bcb3784 Fixes: QTBUG-73425 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
This commit is contained in:
parent
d27d896d8c
commit
5de48ee56a
|
@ -481,6 +481,14 @@ bool ScanFunctions::visit(FieldMemberExpression *ast)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool ScanFunctions::visit(ArrayPattern *ast)
|
||||
{
|
||||
for (PatternElementList *it = ast->elements; it; it = it->next)
|
||||
Node::accept(it->element, this);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ScanFunctions::enterFunction(FunctionExpression *ast, bool enterName)
|
||||
{
|
||||
if (_context->isStrict && (ast->name == QLatin1String("eval") || ast->name == QLatin1String("arguments")))
|
||||
|
|
|
@ -120,6 +120,7 @@ protected:
|
|||
bool visit(AST::TemplateLiteral *ast) override;
|
||||
bool visit(AST::SuperLiteral *) override;
|
||||
bool visit(AST::FieldMemberExpression *) override;
|
||||
bool visit(AST::ArrayPattern *) override;
|
||||
|
||||
bool enterFunction(AST::FunctionExpression *ast, bool enterName);
|
||||
|
||||
|
|
Loading…
Reference in New Issue