mirror of
https://github.com/danbulant/oxc
synced 2026-05-19 12:19:15 +00:00
fix(codegen): fix in in sequence expr in for loops (#6428)
not sure if this is right, but it doesn't break any existing tests so hopefully?
This commit is contained in:
parent
096e590483
commit
6896efc00c
2 changed files with 11 additions and 2 deletions
|
|
@ -1948,9 +1948,9 @@ impl<'a> Gen for AssignmentTargetRest<'a> {
|
|||
}
|
||||
|
||||
impl<'a> GenExpr for SequenceExpression<'a> {
|
||||
fn gen_expr(&self, p: &mut Codegen, precedence: Precedence, _ctx: Context) {
|
||||
fn gen_expr(&self, p: &mut Codegen, precedence: Precedence, ctx: Context) {
|
||||
p.wrap(precedence >= self.precedence(), |p| {
|
||||
p.print_expressions(&self.expressions, Precedence::Lowest, Context::empty());
|
||||
p.print_expressions(&self.expressions, Precedence::Lowest, ctx);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -271,3 +271,12 @@ fn vite_special_comments() {
|
|||
"import(\n\t/* @vite-ignore */\n\tmodule1Url\n).then((module1) => {\n\tself.postMessage(module.default + module1.msg1 + import.meta.env.BASE_URL);\n});\n",
|
||||
);
|
||||
}
|
||||
|
||||
// followup from https://github.com/oxc-project/oxc/pull/6422
|
||||
#[test]
|
||||
fn in_expr_in_sequence_in_for_loop_init() {
|
||||
test(
|
||||
"for (l = ('foo' in bar), i; i < 10; i += 1) {}",
|
||||
"for (l = (\"foo\" in bar), i; i < 10; i += 1) {}\n",
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue