diff options
author | Erik Verbruggen <[email protected]> | 2019-02-04 12:02:01 +0100 |
---|---|---|
committer | Erik Verbruggen <[email protected]> | 2019-02-05 16:05:39 +0000 |
commit | 5de48ee56a5afb0045d40851a4a1dd79db82c772 (patch) | |
tree | c31cf09786dc327e833d5b60b4a05c45ee01f775 /src | |
parent | d27d896d8cb9d240138fe8ea69f1051f74ce1945 (diff) |
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 <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/qml/compiler/qv4compilerscanfunctions.cpp | 8 | ||||
-rw-r--r-- | src/qml/compiler/qv4compilerscanfunctions_p.h | 1 |
2 files changed, 9 insertions, 0 deletions
diff --git a/src/qml/compiler/qv4compilerscanfunctions.cpp b/src/qml/compiler/qv4compilerscanfunctions.cpp index fc3ac769ae..e0eaa8867b 100644 --- a/src/qml/compiler/qv4compilerscanfunctions.cpp +++ b/src/qml/compiler/qv4compilerscanfunctions.cpp @@ -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"))) diff --git a/src/qml/compiler/qv4compilerscanfunctions_p.h b/src/qml/compiler/qv4compilerscanfunctions_p.h index 4463a4f4f3..28ad846bcd 100644 --- a/src/qml/compiler/qv4compilerscanfunctions_p.h +++ b/src/qml/compiler/qv4compilerscanfunctions_p.h @@ -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); |