# `Juggernaut.Mutator.Calls`
[🔗](https://github.com/holsee/juggernaut/blob/v0.4.0/lib/juggernaut/mutator/calls.ex#L1)

Resolves a call site to `{module, function, arguments}` and rebuilds it in the form it
was written.

Three forms are recognised: a remote call (`Enum.sort(xs)`, `:math.pi()`, an aliased
module), a local call (`min(a, b)`, resolved to the module's own function, then
`Kernel`, then a module it imports) and a pipe (`xs |> Enum.sort()`, resolved as the
call it is sugar for, with the piped value as the first argument). The call on the
right of a pipe is not resolved on its own: the `|>` node stands for it, so a family
never sees a call one argument short.

# `call`

```elixir
@type call() :: %{
  module: module() | nil,
  fun: atom(),
  args: [Macro.t()],
  arity: arity(),
  form: :remote | :local | :pipe,
  node: Macro.t()
}
```

# `kernel?`

```elixir
@spec kernel?(atom(), arity()) :: boolean()
```

Whether `fun/arity` is a function or macro of `Kernel`.

# `rebuild`

```elixir
@spec rebuild(call(), atom(), [Macro.t()]) :: Macro.t()
```

The call rebuilt with another function name and arguments, in its written form: a
pipe stays a pipe (its first argument is the piped value).

# `resolve`

```elixir
@spec resolve(Macro.t(), Juggernaut.Mutator.Context.t()) :: {:ok, call()} | :error
```

Resolves `node` to a call, or `:error` when it is not one.

# `target_module`

```elixir
@spec target_module(Macro.t(), Juggernaut.Mutator.Context.t()) ::
  {:ok, module()} | :error
```

The module of a remote call's target: an alias, `__MODULE__` or an Erlang atom.

# `timeout_arg?`

```elixir
@spec timeout_arg?(call(), non_neg_integer()) :: boolean()
```

Whether argument `index` (0-based, piped value included) of `call` is a timeout.

---

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