NewDecl returns a new Decl.
(atom Atom, descrAtoms []Atom, bounds []BoundDecl, constraints *InclusionConstraint)
| 439 | |
| 440 | // NewDecl returns a new Decl. |
| 441 | func NewDecl(atom Atom, descrAtoms []Atom, bounds []BoundDecl, constraints *InclusionConstraint) (Decl, error) { |
| 442 | if descrAtoms == nil { |
| 443 | descrAtoms = []Atom{NewAtom(DescrDoc, String(""))} |
| 444 | } |
| 445 | for i, arg := range atom.Args { |
| 446 | if _, ok := arg.(Variable); ok { |
| 447 | continue |
| 448 | } |
| 449 | return Decl{}, fmt.Errorf("argument %d must be a variable, found %v", i, arg) |
| 450 | } |
| 451 | return Decl{atom, descrAtoms, bounds, constraints}, nil |
| 452 | } |
| 453 | |
| 454 | // NewSyntheticDecl returns a new Decl from an atom. |
| 455 | // The decl has an empty doc, an explicit mode supporting all arguments as input-output, |