exprFmtWithParen is a variant of Format() which adds a set of outer parens if the expression involves an operator. It is used internally when the expression is part of another expression and we know it is preceded or followed by an operator.
(ctx *FmtCtx, e Expr)
| 121 | // expression is part of another expression and we know it is preceded or |
| 122 | // followed by an operator. |
| 123 | func exprFmtWithParen(ctx *FmtCtx, e Expr) { |
| 124 | if _, ok := e.(operatorExpr); ok { |
| 125 | ctx.WriteByte('(') |
| 126 | ctx.FormatNode(e) |
| 127 | ctx.WriteByte(')') |
| 128 | } else { |
| 129 | ctx.FormatNode(e) |
| 130 | } |
| 131 | } |
| 132 | |
| 133 | // typeAnnotation is an embeddable struct to provide a TypedExpr with a dynamic |
| 134 | // type annotation. |
no test coverage detected
searching dependent graphs…