Mutare.Mutator.Mutation.Attribution (mutare v0.4.2)

Copy Markdown View Source

A report-location override for a Mutare.Mutator.Mutation (see its :attribution field).

Names the clause a whole-node rewrite should be reported at, independent of the node spliced into the metamutant. original is the clause before the change (its range locates the site and renders the diff's "before"). operation distinguishes a :replace, whose mutated is the replacement AST, from a :delete, whose mutated is unused (nil). No AST value denotes deletion: at(original, :drop) replaces the original with the atom :drop. Build through Mutare.Mutator.Mutation.at/2 and Mutare.Mutator.Mutation.at_drop/1.

Collected mutations also carry the core-resolved range and position: the source footprint and, when different, the location used for line selection and suppression (for example a stage whose replacement spans its whole pipe). Preserve these fields when relaying a mutation; adapters need not set them.

Summary

Types

deletion()

@type deletion() :: %Mutare.Mutator.Mutation.Attribution{
  mutated: nil,
  operation: :delete,
  original: Macro.t(),
  position: keyword() | nil,
  range: Sourceror.Range.t() | nil
}

replacement()

@type replacement() :: %Mutare.Mutator.Mutation.Attribution{
  mutated: Macro.t(),
  operation: :replace,
  original: Macro.t(),
  position: keyword() | nil,
  range: Sourceror.Range.t() | nil
}

t()

@type t() :: replacement() | deletion()