MCPcopy Create free account
hub / github.com/cockroachdb/cockroachdb-parser / exprFmtWithParen

Function exprFmtWithParen

pkg/sql/sem/tree/expr.go:125–133  ·  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

123// expression is part of another expression and we know it is preceded or
124// followed by an operator.
125func exprFmtWithParen(ctx *FmtCtx, e Expr) {
126 if _, ok := e.(operatorExpr); ok {
127 ctx.WriteByte('(')
128 ctx.FormatNode(e)
129 ctx.WriteByte(')')
130 } else {
131 ctx.FormatNode(e)
132 }
133}
134
135// typeAnnotation is an embeddable struct to provide a TypedExpr with a dynamic
136// 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

Used in the wild real call sites across dependent graphs

searching dependent graphs…