LibJS: Use caller_context to determine strict mode

This is functionaly the same since caller_context is the topmost
execution context on the stack, but makes it more clear that
we are directly inheriting the strict mode from the caller context
when pushing the next context on to the stack.
This commit is contained in:
Shannon Booth 2025-05-16 12:39:06 +12:00 committed by Alexander Kalenik
parent 7d44640c0f
commit 3bf7f94150

View File

@ -151,7 +151,7 @@ ThrowCompletionOr<Value> NativeFunction::internal_call(ExecutionContext& callee_
callee_context.private_environment = caller_context.private_environment;
// NOTE: This is a LibJS specific hack for NativeFunction to inherit the strictness of its caller.
callee_context.is_strict_mode = vm.in_strict_mode();
callee_context.is_strict_mode = caller_context.is_strict_mode;
// </8.> --------------------------------------------------------------------------
@ -210,7 +210,7 @@ ThrowCompletionOr<GC::Ref<Object>> NativeFunction::internal_construct(ReadonlySp
callee_context->variable_environment = caller_context.variable_environment;
// NOTE: This is a LibJS specific hack for NativeFunction to inherit the strictness of its caller.
callee_context->is_strict_mode = vm.in_strict_mode();
callee_context->is_strict_mode = caller_context.is_strict_mode;
// </8.> --------------------------------------------------------------------------