# `MutagenEx.MutationEnumerator.Site`
[🔗](https://github.com/iautom8things/mutagen_ex/blob/v0.2.0/lib/mutagen_ex/mutation_enumerator.ex#L1)

A single mutation site emitted by `MutagenEx.MutationEnumerator`.

Materialises the `t:MutagenEx.Types.mutation_site/0` type. Stored as a
struct (rather than a plain map) so pattern matches catch shape drift at
compile time — the JSON reporter, the mutation runner, and the verifier
all destructure these records.

Fields:

  * `:id` — scheme 2 site ID
    (`"{file}:{hash}:{mutator_name}"`) per
    `mutagen.decision.mutation_id_scheme_2`.
  * `:path` — steps from the file AST root to the original node.
  * `:function` — enclosing definition as `Mod.fun/arity`, or `nil`.
  * `:definition_line` — first line of the named runtime function.
  * `:file` — project-relative source path taken from the
    `MutagenEx.ScopeResolver.Scope` it came from.
  * `:line` / `:column` — 1-based source coordinates of the original AST
    node, for human display only; they do **not** participate in `:id`.
  * `:mutator` — the snake_case atom name of the mutator that produced
    this site (e.g. `:arith`).
  * `:original_ast` — the unmodified AST node, kept so the runner can
    restore it byte-for-byte at compile time (the state-drift-free
    restore invariant in `mutagen.mutation_enumeration.r6`).
  * `:mutated_ast` — the swapped AST node returned by the mutator's
    `mutate/1`.
  * `:end_line` / `:end_column` — 1-based EXCLUSIVE end position of the
    `original_ast` expression in the parsed source, computed
    best-effort from AST metadata per
    `mutagen.mutation_enumeration.r8`. Both are `nil` when the
    enumerator could not derive an end position (bare-literal sites
    whose meta comes from a parent operator, some macro-expanded
    forms). When non-nil, callers slice the verbatim `source_text`
    between the leftmost descendant's `{line, column}` and this
    `{end_line, end_column}` to obtain a byte-faithful
    `before_source` per `mutagen.json_schema.r4`.
  * `:source_span` — byte offset and length of the expression in the cached
    source text, when source reporting is enabled and the span is available.

# `path_step`

```elixir
@type path_step() ::
  :form
  | :left
  | :right
  | {:arg, non_neg_integer()}
  | {:elem, non_neg_integer()}
```

# `t`

```elixir
@type t() :: %MutagenEx.MutationEnumerator.Site{
  column: pos_integer(),
  definition_line: pos_integer() | nil,
  end_column: pos_integer() | nil,
  end_line: pos_integer() | nil,
  execution: :cover | :probe | nil,
  file: String.t(),
  function: String.t() | nil,
  id: String.t(),
  line: pos_integer(),
  mutated_ast: Macro.t(),
  mutator: atom(),
  original_ast: Macro.t(),
  path: [path_step()],
  source_line: pos_integer() | nil,
  source_span: {non_neg_integer(), pos_integer()} | nil
}
```

---

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