mirror of
https://github.com/danbulant/oxc
synced 2026-05-24 20:32:10 +00:00
fix(prettier): remove unnecessary group and ident in BinaryishExpression (#1337)
This commit is contained in:
parent
8d7c0d73d1
commit
b443a0798f
2 changed files with 7 additions and 13 deletions
|
|
@ -2,7 +2,7 @@
|
|||
use oxc_ast::ast::*;
|
||||
use oxc_syntax::operator::{BinaryOperator, LogicalOperator};
|
||||
|
||||
use crate::{doc::Doc, group, ss, Format, Prettier};
|
||||
use crate::{doc::Doc, ss, Format, Prettier};
|
||||
|
||||
pub enum BinaryishLeft<'a, 'b> {
|
||||
Expression(&'b Expression<'a>),
|
||||
|
|
@ -42,15 +42,10 @@ impl<'a> Prettier<'a> {
|
|||
) -> Doc<'a> {
|
||||
let mut parts = self.vec();
|
||||
parts.push(left.format(self));
|
||||
let mut parts_inner = self.vec();
|
||||
parts_inner.push(ss!(" "));
|
||||
let mut parts_inner_inner = self.vec();
|
||||
parts_inner_inner.push(ss!(operator.as_str()));
|
||||
parts_inner_inner.push(Doc::Line);
|
||||
parts_inner_inner.push(right.format(self));
|
||||
let indent = Doc::Indent(parts_inner_inner);
|
||||
parts_inner.push(group!(self, indent));
|
||||
parts.push(Doc::Indent(parts_inner));
|
||||
Doc::Group(parts)
|
||||
parts.push(ss!(" "));
|
||||
parts.push(ss!(operator.as_str()));
|
||||
parts.push(Doc::Line);
|
||||
parts.push(right.format(self));
|
||||
Doc::Array(parts)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
Compatibility: 5/173 (2.89%)
|
||||
Compatibility: 6/173 (3.47%)
|
||||
|
||||
# Failed
|
||||
|
||||
|
|
@ -140,7 +140,6 @@ Compatibility: 5/173 (2.89%)
|
|||
* reserved-word
|
||||
* rest
|
||||
* return
|
||||
* return-outside-function
|
||||
* sequence-break
|
||||
* sequence-expression
|
||||
* shebang
|
||||
|
|
|
|||
Loading…
Reference in a new issue