MCPcopy
hub / github.com/google/mangle / checkBound

Method checkBound

analysis/declcheck.go:106–115  ·  view source on GitHub ↗

Checks that a boundDecl is well-formed. It validates that there is a bound for each argument, and that each bound is a well-formed bound.

(p ast.Atom, boundDecl ast.BoundDecl)

Source from the content-addressed store, hash-verified

104// It validates that there is a bound for each argument, and
105// that each bound is a well-formed bound.
106func (c *declChecker) checkBound(p ast.Atom, boundDecl ast.BoundDecl) {
107 if len(boundDecl.Bounds) != len(p.Args) {
108 c.errs = append(c.errs, fmt.Errorf("in decl %v: expected %d bounds, got %d: %v ", p, len(p.Args), len(boundDecl.Bounds), boundDecl.Bounds))
109 }
110 for i, bound := range boundDecl.Bounds {
111 if err := symbols.WellformedBound(bound); err != nil {
112 c.errs = append(c.errs, fmt.Errorf("in decl %v: the bound for argument %d must be parseable as predicate name: %v (%w)", p, i, bound, err))
113 }
114 }
115}
116
117// Checks that a base term is a string constant.
118func (c *declChecker) checkStringConstant(baseTerm ast.BaseTerm) {

Callers 1

checkMethod · 0.95

Calls 1

WellformedBoundFunction · 0.92

Tested by

no test coverage detected