# `Statifier.Compiler.FunctionCalls`
[🔗](https://github.com/riddler/statifier-ex/blob/v2.15.0/lib/statifier/compiler/function_calls.ex#L1)

The compile-time check that every function a chart's expressions call is
one the chart can be evaluated with: `In/1`, a predicator builtin, or a
function the host registers through `Statifier.compile/2`'s
`:function_providers` option.

It reads the compiled `Statifier.Machine` rather than the document: every
`cond`, `expr`, `<script>` and other predicator source has already been
compiled to a `%Predicator.Compiled{}` by then, and a call is one
top-level `["call", name, arity]` instruction in it. A name outside the known set
becomes one `Statifier.Compiler.Error` with reason
`{:unknown_function, name, source}`, reported at the location of the
element whose expression makes the call.

Only the name is checked, not the arity: a call with the wrong number of
arguments to a known function still compiles and fails at evaluation, as
it always has.

# `check`

```elixir
@spec check(machine :: Statifier.Machine.t(), known :: MapSet.t(String.t())) :: [
  Statifier.Compiler.Error.t()
]
```

One error per distinct `{name, location}` pair whose `name` is not in
`known`, ordered by location. `[]` when every call names a known
function, which is always true of a chart that calls none.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
