Skip to content

Commit b27f19b

Browse files
committed
Add test for find_var_htab scope_level regression
1 parent 6bec763 commit b27f19b

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

tests/test_find_var_htab.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import { assert } from "./assert.js";
2+
3+
// Regression test for find_var_htab: when a var shadows a block-scoped
4+
// let of the same name, the htab probe must skip entries with
5+
// scope_level != 0. 28 vars are needed to trigger the htab path.
6+
function test_find_var_htab() {
7+
{ let x = "let"; }
8+
var v0, v1, v2, v3, v4, v5, v6, v7, v8, v9;
9+
var v10, v11, v12, v13, v14, v15, v16, v17, v18, v19;
10+
var v20, v21, v22, v23, v24, v25, v26;
11+
var x = "var";
12+
13+
function closure() {
14+
return x;
15+
}
16+
17+
assert(closure(), "var", "find_var_htab returned wrong slot index");
18+
}
19+
20+
test_find_var_htab();

0 commit comments

Comments
 (0)