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

Function NewDecl

ast/decl.go:441–452  ·  view source on GitHub ↗

NewDecl returns a new Decl.

(atom Atom, descrAtoms []Atom, bounds []BoundDecl, constraints *InclusionConstraint)

Source from the content-addressed store, hash-verified

439
440// NewDecl returns a new Decl.
441func 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,

Callers 15

makeDeclFunction · 0.92
TestShortestPathsFunction · 0.92
TestTopDownFunction · 0.92
TestInclusionCheckFunction · 0.92
makeDeclFunction · 0.92
VisitDeclMethod · 0.92
makeDeclFunction · 0.92
TestCheckRuleBindsByDeclFunction · 0.92
TestDeferredFunction · 0.92

Calls 2

NewAtomFunction · 0.85
StringFunction · 0.85

Tested by 14

makeDeclFunction · 0.74
TestShortestPathsFunction · 0.74
TestTopDownFunction · 0.74
TestInclusionCheckFunction · 0.74
makeDeclFunction · 0.74
makeDeclFunction · 0.74
TestCheckRuleBindsByDeclFunction · 0.74
TestDeferredFunction · 0.74
mustDeclFunction · 0.74