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

Method SignatureWithDefaults

pkg/sql/sem/tree/overload.go:380–393  ·  view source on GitHub ↗

SignatureWithDefaults is the same as Signature but also allows specifying whether DEFAULT expressions should be included.

(simplify bool, includeDefaults bool)

Source from the content-addressed store, hash-verified

378// SignatureWithDefaults is the same as Signature but also allows specifying
379// whether DEFAULT expressions should be included.
380func (b Overload) SignatureWithDefaults(simplify bool, includeDefaults bool) string {
381 retType := b.FixedReturnType()
382 if simplify {
383 if retType.Family() == types.TupleFamily && len(retType.TupleContents()) == 1 {
384 retType = retType.TupleContents()[0]
385 }
386 }
387 t, ok := b.Types.(ParamTypes)
388 if !includeDefaults || len(b.DefaultExprs) == 0 || !ok {
389 return fmt.Sprintf("(%s) -> %s", b.Types.String(), retType)
390 }
391 return fmt.Sprintf("(%s) -> %s", t.StringWithDefaultExprs(b.DefaultExprs), retType)
392
393}
394
395// overloadImpl is an implementation of an overloaded function. It provides
396// access to the parameter type list and the return type of the implementation.

Callers 1

SignatureMethod · 0.95

Calls 5

FixedReturnTypeMethod · 0.95
FamilyMethod · 0.80
TupleContentsMethod · 0.80
StringMethod · 0.65

Tested by

no test coverage detected