MCPcopy Create free account
hub / github.com/dolthub/doltgresql / exprFmtWithParen

Function exprFmtWithParen

postgres/parser/sem/tree/expr.go:128–136  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

126// expression is part of another expression and we know it is preceded or
127// followed by an operator.
128func exprFmtWithParen(ctx *FmtCtx, e Expr) {
129 if _, ok := e.(operatorExpr); ok {
130 ctx.WriteByte('(')
131 ctx.FormatNode(e)
132 ctx.WriteByte(')')
133 } else {
134 ctx.FormatNode(e)
135 }
136}
137
138// typeAnnotation is an embeddable struct to provide a TypedExpr with a dynamic
139// type annotation.

Callers 12

binExprFmtWithParenFunction · 0.85
FormatMethod · 0.85
FormatMethod · 0.85
FormatMethod · 0.85
FormatMethod · 0.85
FormatMethod · 0.85
FormatMethod · 0.85
FormatMethod · 0.85
FormatMethod · 0.85
FormatMethod · 0.85
FormatMethod · 0.85

Calls 1

FormatNodeMethod · 0.80

Tested by

no test coverage detected