Statifier.Document.If.Branch (Statifier v2.0.0)

Copy Markdown View Source

One partition of an <if> - the executable content between one partitioning tag (<if>, <elseif>, or <else>) and the next, per Statifier.Document.If's moduledoc.

cond is nil for the <else> branch and for a branch with no cond at all - spec 4.5.1: "<else> ... is equivalent to an <elseif> with a 'cond' that always evaluates to true." location is this branch's own partitioning tag's span (the <if>, <elseif>, or <else> element itself), not the <if>'s overall span - it is where Statifier.Validator.Checks.If (Phase 3) reports a branch-ordering error against the offending branch rather than the whole <if>. attribute_locations carries :cond's value span when the branch wrote one, following every other node's contract (lib/statifier/document.ex:22-44).

Unlike Statifier.Document.Assign, there is no name collision here between an attribute value and the element's own span, so location keeps its usual meaning and needs no node_location rename.

Summary

Types

t()

@type t() :: %Statifier.Document.If.Branch{
  attribute_locations: Statifier.Document.attribute_locations(),
  cond: String.t() | nil,
  content: [Statifier.Document.content_node()],
  location: Statifier.Parser.Location.t()
}