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

Method checkFunctions

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

Source from the content-addressed store, hash-verified

978}
979
980func (a *Analyzer) checkFunctions(clause ast.Clause) error {
981 // Just check arity. Types left for later.
982 for _, p := range clause.Premises {
983 switch x := p.(type) {
984 case ast.Atom:
985 for _, arg := range x.Args {
986 if err := a.checkExprArity(arg); err != nil {
987 return err
988 }
989 }
990 case ast.NegAtom:
991 for _, arg := range x.Atom.Args {
992 if err := a.checkExprArity(arg); err != nil {
993 return err
994 }
995 }
996 case ast.Eq:
997 if err := a.checkExprArity(x.Left); err != nil {
998 return err
999 }
1000 if err := a.checkExprArity(x.Right); err != nil {
1001 return err
1002 }
1003 case ast.Ineq:
1004 if err := a.checkExprArity(x.Left); err != nil {
1005 return err
1006 }
1007 if err := a.checkExprArity(x.Right); err != nil {
1008 return err
1009 }
1010 }
1011 }
1012
1013 if clause.Transform == nil {
1014 return nil
1015 }
1016 for _, stmt := range clause.Transform.Statements {
1017 if err := a.checkExprArity(stmt.Fn); err != nil {
1018 return err
1019 }
1020 }
1021 return nil
1022}
1023
1024// BoundsCheck checks whether the rules respect the bounds.
1025func (bc *BoundsAnalyzer) BoundsCheck() error {

Callers 1

CheckRuleMethod · 0.95

Calls 1

checkExprArityMethod · 0.95

Tested by

no test coverage detected