Skip to content

Commit

Permalink
Fix basic_scoping.js compiler test
Browse files Browse the repository at this point in the history
See the added comments for more details.
  • Loading branch information
Samuel Groß committed Jul 31, 2024
1 parent cea391f commit 476232c
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions Tests/FuzzilliTests/CompilerTests/basic_scoping.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,21 @@ function foo(x) {
}
output(x);
output(y);
let obj = { x: 45, y: 9001 };
with (obj) {
output(x);
output(y);
}
}
foo(44);

// Note: this test will currently fail if 'a' and 'b' are replaced by
// 'x' and 'y' in the object. That's because the compiler will still used
// regular/numbered variables for x and y, and so will effectively rename
// them to something like `v1` and `v2`, while keeping the property names
// of the object. This isn't easy to fix, unfortunately. One option might
// be to change the compiler to only use named variables in testcases that
// use `with` statements, but that would be quite an invasive change and
// result in a FuzzIL program that is less suited for mutations.
let obj = { a: 45, b: 9001 };
with (obj) {
output(x);
output(y);
output(a);
output(b);
}
foo(44);

0 comments on commit 476232c

Please sign in to comment.