LibJS: Mark catch parameter as initialized local when applicable
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

Otherwise we'll emit a TDZ check for every `catch` parameter immediately
after initializing it. This check would never fail, so it's redundant.
This commit is contained in:
Andreas Kling 2025-04-29 16:41:31 +02:00 committed by Andreas Kling
parent 00f7a6f9e0
commit 7a600e60bc
Notes: github-actions[bot] 2025-04-30 07:39:35 +00:00

View file

@ -2656,6 +2656,7 @@ Bytecode::CodeGenerationErrorOr<Optional<ScopedOperand>> TryStatement::generate_
if (parameter->is_local()) {
auto local = generator.local(parameter->local_index());
generator.emit_mov(local, caught_value);
generator.set_local_initialized(parameter->local_index());
} else {
generator.begin_variable_scope();
did_create_variable_scope_for_catch_clause = true;