feat(printer) Print BreakStatement (#1274)

This commit is contained in:
Cameron 2023-11-13 18:28:06 +00:00 committed by GitHub
parent cef4c88579
commit f892a9e8a1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -159,7 +159,15 @@ impl<'a> Format<'a> for ContinueStatement {
impl<'a> Format<'a> for BreakStatement {
fn format(&self, p: &mut Prettier<'a>) -> Doc<'a> {
Doc::Line
let mut parts = p.vec();
parts.push(string!(p, "break"));
if let Some(label) = &self.label {
parts.push(string!(p, " "));
parts.push(format!(p, label));
}
Doc::Array(parts)
}
}