1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 11:17:35 +00:00

LibJS: Implement the PrepareForOrdinaryCall abstract operation

This is used by VM::call_internal() and VM::construct() which roughly
map to function objects' [[Call]] and [[Construct]] slots in the spec.

Reorganizing this code revealed something weird: NativeFunction gets
its strictness by checking VM::in_strict_mode(). In other words,
it inherits the strict flag from the caller context. This is quite
weird, but many test-js tests rely on it, so let's preserve it until
we can think of something nicer.
This commit is contained in:
Andreas Kling 2021-07-02 21:02:56 +02:00
parent 8ed3315dec
commit 5ce9305c5f
2 changed files with 80 additions and 32 deletions

View file

@ -260,6 +260,7 @@ private:
VM();
[[nodiscard]] Value call_internal(FunctionObject&, Value this_value, Optional<MarkedValueList> arguments);
void prepare_for_ordinary_call(FunctionObject&, ExecutionContext& callee_context, Value new_target);
Exception* m_exception { nullptr };