mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 01:35:08 +02:00
When the left-hand side of an assignment, update, or for-in loop is invalid (e.g. `foo() = "bar"`), the bytecode generator emits a Throw instruction. Previously, it would also create a dead basic block after the Throw, resulting in unreachable instructions in the output. Fix this by returning early from the relevant codegen paths after emitting the Throw, and by guarding for-in/for-of body generation with an is_current_block_terminated() check.
7 lines
156 B
JavaScript
7 lines
156 B
JavaScript
// Test that for-in with an invalid LHS (like a call expression)
|
|
// does NOT emit dead code after the Throw instruction.
|
|
|
|
function f() {}
|
|
|
|
for (f() in []);
|