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

Method checkPredicates

analysis/validation.go:856–883  ·  view source on GitHub ↗
(clause ast.Clause)

Source from the content-addressed store, hash-verified

854}
855
856func (a *Analyzer) checkPredicates(clause ast.Clause) error {
857 return a.check(func(sym ast.PredicateSym) error {
858 if _, ok := a.decl[sym]; ok {
859 return nil
860 }
861 if _, ok := builtin.Predicates[sym]; ok {
862 return nil
863 }
864 if len(a.extraPredicates) > 0 {
865 if _, ok := a.extraPredicates[sym]; ok {
866 return nil
867 }
868 }
869
870 var arities []int
871 for declared := range a.decl {
872 if declared.Symbol == sym.Symbol {
873 arities = append(arities, declared.Arity)
874 }
875 }
876 if len(arities) > 0 {
877 return fmt.Errorf(
878 "in clause %q: predicate %s called with %d arguments, but available arities are: %v",
879 clause, sym.Symbol, sym.Arity, arities)
880 }
881 return fmt.Errorf("in clause %q could not find predicate %v", clause, sym)
882 }, clause)
883}
884
885func (a *Analyzer) checkVisibility(clause ast.Clause) error {
886 var pkg string

Callers 1

CheckRuleMethod · 0.95

Calls 1

checkMethod · 0.95

Tested by

no test coverage detected