Add PreInc

This commit is contained in:
flameyosflow 2025-12-16 12:11:51 +02:00
commit bc1e2a2b21

View file

@ -1273,6 +1273,16 @@ impl Parser {
attributes: Vec::new(),
})
}
Some(Token::PlusPlus) => {
self.next();
let expr = self.parse_unary_expr()?;
let end = expr.span.end;
Ok(Expr {
kind: ExprKind::UnOp(UnOp::PreInc, Box::new(expr)),
span: Span::new(&(start..end), self.file.clone()),
attributes: Vec::new(),
})
}
_ => self.parse_postfix_expr(),
}
}