mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 16:37:35 +00:00
LibJS: Fix BindingPattern::contains_expression() is name is expression
If any of binding pattern entry's name is expession `contains_expression()` should return true. For example: ```js function evalInComputedPropertyKey( {[eval("var x = 'inner'")]: ignored} ) {} ``` `contains_expression()` should return true for the binding param in this function.
This commit is contained in:
parent
aeb8b5685f
commit
4561469d52
1 changed files with 2 additions and 0 deletions
|
@ -792,6 +792,8 @@ void NullLiteral::dump(int indent) const
|
|||
bool BindingPattern::contains_expression() const
|
||||
{
|
||||
for (auto& entry : entries) {
|
||||
if (entry.name.has<NonnullRefPtr<Expression const>>())
|
||||
return true;
|
||||
if (entry.initializer)
|
||||
return true;
|
||||
if (auto binding_ptr = entry.alias.get_pointer<NonnullRefPtr<BindingPattern const>>(); binding_ptr && (*binding_ptr)->contains_expression())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue