fix: capture object keys and scope loop bindings

This commit is contained in:
爱特每羊队
2026-08-11 14:17:45 +08:00
parent 925ca358e9
commit ec2efa7b6b
8 changed files with 77 additions and 10 deletions
@@ -194,6 +194,14 @@ fn eval_for_in_let_scoping() {
assert_eq!(result, "1");
}
#[test]
fn eval_adjacent_for_of_lexical_bindings_do_not_conflict() {
assert_eq!(
eval("let out=0; for (const [arg, descr] of [[1, 'a']]) out += arg; for (const [arg, descr] of [[2, 'b']]) out += arg; out"),
"3"
);
}
#[test]
fn eval_switch_basic_match() {
assert_eq!(eval("var x=0;switch(2){case 1:x=10;case 2:x=20;break;default:x=30;}x"), "20");