variablesForArgMode returns variable arguments that match an argmode mask.
(atom ast.Atom, mode ast.Mode, mask ast.ArgMode)
| 488 | |
| 489 | // variablesForArgMode returns variable arguments that match an argmode mask. |
| 490 | func variablesForArgMode(atom ast.Atom, mode ast.Mode, mask ast.ArgMode) []ast.Variable { |
| 491 | var boundVars []ast.Variable |
| 492 | |
| 493 | for i, argMode := range mode { |
| 494 | if argMode&mask == 0 { |
| 495 | continue |
| 496 | } |
| 497 | |
| 498 | if v, ok := atom.Args[i].(ast.Variable); ok { |
| 499 | boundVars = append(boundVars, v) |
| 500 | } |
| 501 | } |
| 502 | |
| 503 | return boundVars |
| 504 | } |
| 505 | |
| 506 | // CheckRule checks arity and that every variable appearing is bound. |
| 507 | // A variable is bound when: |
no outgoing calls
no test coverage detected