From f892a9e8a1f1ea8bd1ccb09acecf5668c803b02a Mon Sep 17 00:00:00 2001 From: Cameron Date: Mon, 13 Nov 2023 18:28:06 +0000 Subject: [PATCH] feat(printer) Print `BreakStatement` (#1274) --- crates/oxc_prettier/src/format.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/crates/oxc_prettier/src/format.rs b/crates/oxc_prettier/src/format.rs index 8894b81ad..2d6ef9d79 100644 --- a/crates/oxc_prettier/src/format.rs +++ b/crates/oxc_prettier/src/format.rs @@ -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) } }