mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 16:57:35 +00:00
LibJS: Follow the spec more closely when determining the this value
Co-authored-by: davidot <david.tuin@gmail.com>
This commit is contained in:
parent
a394aa5830
commit
c6e9c6d6ab
3 changed files with 36 additions and 11 deletions
|
@ -161,12 +161,8 @@ CallExpression::ThisAndCallee CallExpression::compute_this_and_callee(Interprete
|
|||
return { this_value, callee };
|
||||
}
|
||||
|
||||
if (interpreter.vm().in_strict_mode()) {
|
||||
// If we are in strict mode, |this| should never be bound to global object by default.
|
||||
return { js_undefined(), m_callee->execute(interpreter, global_object) };
|
||||
}
|
||||
|
||||
return { &global_object, m_callee->execute(interpreter, global_object) };
|
||||
// [[Call]] will handle that in non-strict mode the this value becomes the global object
|
||||
return { js_undefined(), m_callee->execute(interpreter, global_object) };
|
||||
}
|
||||
|
||||
// 13.3.8.1 Runtime Semantics: ArgumentListEvaluation, https://tc39.es/ecma262/#sec-runtime-semantics-argumentlistevaluation
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue