mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-28 10:37:17 +02:00
The Rust bytecode codegen was missing a TDZ check before assigning to local let/const variables in simple assignment expressions (a = expr). The C++ pipeline correctly emits ThrowIfTDZ before the store to ensure temporal dead zone semantics are enforced. Add an emit_tdz_check_if_needed helper matching the C++ equivalent, and call it in the simple assignment path.
13 lines
282 B
JavaScript
13 lines
282 B
JavaScript
// Test that simple assignment to a let variable emits ThrowIfTDZ
|
|
// before the store, ensuring TDZ semantics are enforced.
|
|
|
|
function g(x) { return x; }
|
|
|
|
function f(n) {
|
|
let { location: a } = n;
|
|
"string" == typeof a && (a = g(a));
|
|
return a;
|
|
}
|
|
|
|
f({ location: "hello" });
|