LibJS: Use caller_context to determine strict mode
Some checks are pending
CI / Lagom (arm64, Sanitizer_CI, false, macos-15, macOS, Clang) (push) Waiting to run
CI / Lagom (x86_64, Fuzzers_CI, false, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, false, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, true, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (arm64, macos-15, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (x86_64, ubuntu-24.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run

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
Notes: github-actions[bot] 2025-05-23 01:26:48 +00:00

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.> --------------------------------------------------------------------------