mirror of
https://github.com/danbulant/oxc
synced 2026-05-24 20:32:10 +00:00
feat(printer) Print TryStatement (#1277)
This commit is contained in:
parent
2adfec6c0f
commit
3db074b87c
1 changed files with 21 additions and 0 deletions
|
|
@ -204,6 +204,27 @@ impl<'a> Format<'a> for LabeledStatement<'a> {
|
|||
}
|
||||
|
||||
impl<'a> Format<'a> for TryStatement<'a> {
|
||||
fn format(&self, p: &mut Prettier<'a>) -> Doc<'a> {
|
||||
let mut parts = p.vec();
|
||||
parts.push(string!(p, "try "));
|
||||
|
||||
parts.push(format!(p, self.block));
|
||||
|
||||
if let Some(handler) = &self.handler {
|
||||
parts.push(string!(p, " "));
|
||||
parts.push(format!(p, handler));
|
||||
}
|
||||
|
||||
if let Some(finalizer) = &self.finalizer {
|
||||
parts.push(string!(p, " finally "));
|
||||
parts.push(format!(p, finalizer));
|
||||
}
|
||||
|
||||
Doc::Array(parts)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Format<'a> for CatchClause<'a> {
|
||||
fn format(&self, p: &mut Prettier<'a>) -> Doc<'a> {
|
||||
Doc::Line
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue