mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 09:58:11 +00:00
LibJS: Use CreateUnmappedArgumentsObject for non-simple parameter lists
This patch implements the IsSimpleParameterList static semantics for ordinary function objects. We now also create an unmapped arguments object for callee contexts with non-simple parameter lists, instead of only doing it in strict mode. Covered by test262.
This commit is contained in:
parent
e2e695bc9f
commit
d1ffeaf66d
3 changed files with 18 additions and 1 deletions
|
@ -68,6 +68,17 @@ OrdinaryFunctionObject::OrdinaryFunctionObject(GlobalObject& global_object, cons
|
|||
set_this_mode(ThisMode::Strict);
|
||||
else
|
||||
set_this_mode(ThisMode::Global);
|
||||
|
||||
// 15.1.3 Static Semantics: IsSimpleParameterList, https://tc39.es/ecma262/#sec-static-semantics-issimpleparameterlist
|
||||
set_has_simple_parameter_list(all_of(m_parameters.begin(), m_parameters.end(), [&](auto& parameter) {
|
||||
if (parameter.is_rest)
|
||||
return false;
|
||||
if (parameter.default_value)
|
||||
return false;
|
||||
if (!parameter.binding.template has<FlyString>())
|
||||
return false;
|
||||
return true;
|
||||
}));
|
||||
}
|
||||
|
||||
void OrdinaryFunctionObject::initialize(GlobalObject& global_object)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue