We extract name constants from declarations. We build a trie of names that play the role of type expressions. so we can later map name constants to their corresponding, most precise (longest prefix) type expression.
(extraPredicates map[ast.PredicateSym]ast.Decl, decls map[ast.PredicateSym]*ast.Decl)
| 408 | // that play the role of type expressions. so we can later map name constants to their |
| 409 | // corresponding, most precise (longest prefix) type expression. |
| 410 | func collectNames(extraPredicates map[ast.PredicateSym]ast.Decl, decls map[ast.PredicateSym]*ast.Decl) symbols.NameTrie { |
| 411 | nameTrie := symbols.NewNameTrie() |
| 412 | handleDecl := func(d ast.Decl) { |
| 413 | for _, bs := range d.Bounds { |
| 414 | for _, typeExpr := range bs.Bounds { |
| 415 | nameTrie.Collect(typeExpr) |
| 416 | } |
| 417 | } |
| 418 | } |
| 419 | for _, d := range extraPredicates { |
| 420 | handleDecl(d) |
| 421 | } |
| 422 | for _, d := range decls { |
| 423 | handleDecl(*d) |
| 424 | } |
| 425 | return nameTrie |
| 426 | } |
| 427 | |
| 428 | func newBoundsAnalyzer(programInfo *ProgramInfo, nameTrie symbols.NameTrie, initialFacts []ast.Atom, rulesMap map[ast.PredicateSym][]ast.Clause) (*BoundsAnalyzer, error) { |
| 429 | var err error |