mirror of
https://github.com/danbulant/oxc
synced 2026-05-24 12:21:58 +00:00
feat(prettier) Print labeled statement (#1393)
This commit is contained in:
parent
ecbe0a4b98
commit
db71974655
2 changed files with 6 additions and 7 deletions
|
|
@ -355,7 +355,11 @@ impl<'a> Format<'a> for ReturnStatement<'a> {
|
|||
|
||||
impl<'a> Format<'a> for LabeledStatement<'a> {
|
||||
fn format(&self, p: &mut Prettier<'a>) -> Doc<'a> {
|
||||
Doc::Line
|
||||
if matches!(self.body, Statement::EmptyStatement(_)) {
|
||||
return array!(p, self.label.format(p), ss!(":;"));
|
||||
}
|
||||
|
||||
array!(p, self.label.format(p), ss!(": "), format!(p, self.body))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
Compatibility: 63/881 (7.15%)
|
||||
Compatibility: 66/881 (7.49%)
|
||||
|
||||
# Failed
|
||||
|
||||
|
|
@ -653,9 +653,7 @@ Compatibility: 63/881 (7.15%)
|
|||
* import-reflection/valid-module-as-default-binding.mjs
|
||||
|
||||
### label
|
||||
* label/block-statement-and-regexp.js
|
||||
* label/comment.js
|
||||
* label/empty_label.js
|
||||
|
||||
### last-argument-expansion
|
||||
* last-argument-expansion/arrow.js
|
||||
|
|
@ -981,9 +979,6 @@ Compatibility: 63/881 (7.15%)
|
|||
* shebang/shebang-newline.js
|
||||
* shebang/shebang.js
|
||||
|
||||
### sloppy-mode
|
||||
* sloppy-mode/labeled-function-declaration.js
|
||||
|
||||
### source-phase-imports
|
||||
* source-phase-imports/default-binding.js
|
||||
* source-phase-imports/import-source-attributes-declaration.js
|
||||
|
|
|
|||
Loading…
Reference in a new issue