(&self, mut opt: WriteOpt)
| 25 | |
| 26 | impl WriteSource for pr::Expr { |
| 27 | fn write(&self, mut opt: WriteOpt) -> Option<String> { |
| 28 | let mut r = String::new(); |
| 29 | |
| 30 | if let Some(alias) = &self.alias { |
| 31 | r += opt.consume(&write_ident_part(alias))?; |
| 32 | r += opt.consume(" = ")?; |
| 33 | opt.unbound_expr = false; |
| 34 | } |
| 35 | |
| 36 | if !needs_parenthesis(self, &opt) { |
| 37 | r += &self.kind.write(opt.clone())?; |
| 38 | } else { |
| 39 | let value = self.kind.write_between("(", ")", opt.clone()); |
| 40 | |
| 41 | if let Some(value) = value { |
| 42 | r += &value; |
| 43 | } else { |
| 44 | r += &break_line_within_parenthesis(&self.kind, opt)?; |
| 45 | } |
| 46 | }; |
| 47 | Some(r) |
| 48 | } |
| 49 | } |
| 50 | |
| 51 | fn needs_parenthesis(this: &pr::Expr, opt: &WriteOpt) -> bool { |
no test coverage detected