mirror of
https://github.com/danbulant/oxc
synced 2026-05-25 04:42:10 +00:00
fix(codegen): missing parens for in in for in loop init (#7705)
Well, this looks like an accidental change before, `Context::empty().and_forbid_in(false)` does nothing at all.
This commit is contained in:
parent
4afbe5599e
commit
8c3a954336
2 changed files with 5 additions and 5 deletions
|
|
@ -291,7 +291,7 @@ impl Gen for ForInStatement<'_> {
|
||||||
p.print_str("for");
|
p.print_str("for");
|
||||||
p.print_soft_space();
|
p.print_soft_space();
|
||||||
p.print_ascii_byte(b'(');
|
p.print_ascii_byte(b'(');
|
||||||
self.left.print(p, Context::empty().and_forbid_in(false));
|
self.left.print(p, Context::FORBID_IN);
|
||||||
p.print_soft_space();
|
p.print_soft_space();
|
||||||
p.print_space_before_identifier();
|
p.print_space_before_identifier();
|
||||||
p.print_str("in");
|
p.print_str("in");
|
||||||
|
|
|
||||||
|
|
@ -64,10 +64,10 @@ fn for_stmt() {
|
||||||
"for (x = (y in z) || y || (y in z) || y || (y in z);;);",
|
"for (x = (y in z) || y || (y in z) || y || (y in z);;);",
|
||||||
"for (x = (y in z) || y || (y in z) || y || (y in z);;);\n",
|
"for (x = (y in z) || y || (y in z) || y || (y in z);;);\n",
|
||||||
);
|
);
|
||||||
// test(
|
test(
|
||||||
// "for (var a = 1 || (2 in {}) in { x: 1 }) count++;",
|
"for (var a = 1 || (2 in {}) in { x: 1 }) count++;",
|
||||||
// "for (var a = 1 || (2 in {}) in {x: 1}) count++;\n",
|
"for (var a = 1 || (2 in {}) in { x: 1 }) count++;\n",
|
||||||
// );
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue