feat(printer) Print UpdateExpression (#1272)

This commit is contained in:
Cameron 2023-11-13 18:27:08 +00:00 committed by GitHub
parent 1fb12d0088
commit a7acd07df8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -607,7 +607,17 @@ impl<'a> Format<'a> for YieldExpression<'a> {
impl<'a> Format<'a> for UpdateExpression<'a> {
fn format(&self, p: &mut Prettier<'a>) -> Doc<'a> {
Doc::Line
let mut parts = p.vec();
parts.push(p.str(self.operator.as_str()));
parts.push(format!(p, self.argument));
if self.prefix {
parts.reverse();
}
Doc::Array(parts)
}
}