mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 14:48:14 +00:00
LibJS: Add the Function.[[ThisMode]] field
This is not a behavioral change in itself, just prep work for future spec-compliance changes.
This commit is contained in:
parent
b650d11dd3
commit
667bba2410
2 changed files with 18 additions and 0 deletions
|
@ -61,6 +61,13 @@ ScriptFunction::ScriptFunction(GlobalObject& global_object, const FlyString& nam
|
|||
, m_is_strict(is_strict)
|
||||
, m_is_arrow_function(is_arrow_function)
|
||||
{
|
||||
// NOTE: This logic is from OrdinaryFunctionCreate, https://tc39.es/ecma262/#sec-ordinaryfunctioncreate
|
||||
if (m_is_arrow_function)
|
||||
set_this_mode(ThisMode::Lexical);
|
||||
else if (m_is_strict)
|
||||
set_this_mode(ThisMode::Strict);
|
||||
else
|
||||
set_this_mode(ThisMode::Global);
|
||||
}
|
||||
|
||||
void ScriptFunction::initialize(GlobalObject& global_object)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue