mirror of
https://github.com/danbulant/oxc
synced 2026-05-19 12:19:15 +00:00
fix(codegen): fix arithmetic overflow printing unspanned NewExpression (#7289)
`self.span.end - 1` overflows if the `NewExpression` is generated in transformer and has no span, so `self.span.end == 0`.
This commit is contained in:
parent
8da23692fc
commit
33ec4e6182
1 changed files with 1 additions and 1 deletions
|
|
@ -2067,7 +2067,7 @@ impl<'a> GenExpr for NewExpression<'a> {
|
|||
p.print_str("new ");
|
||||
self.callee.print_expr(p, Precedence::New, Context::FORBID_CALL);
|
||||
p.print_ascii_byte(b'(');
|
||||
let has_comment = p.has_comment(self.span.end - 1)
|
||||
let has_comment = (!self.span.is_unspanned() && p.has_comment(self.span.end - 1))
|
||||
|| self.arguments.iter().any(|item| p.has_comment(item.span().start));
|
||||
if has_comment {
|
||||
p.indent();
|
||||
|
|
|
|||
Loading…
Reference in a new issue