Class IdentifierReadOrError

All Implemented Interfaces:
Consumer<org.antlr.v4.runtime.ParserRuleContext>

final class IdentifierReadOrError extends TypedSymbolAccess implements Consumer<org.antlr.v4.runtime.ParserRuleContext>
THE check of a READ of a local or returning variable that may still be uninitialised (E08020): every grammar position that loads a variable's value hands its read node here - this is the one consumer, do not write another.

The node is the one phase 3 recorded the resolved symbol against: an identifierReference (every expression read, x++), the identifier of an objectAccessStart (name.length()), the identifier of a pipelinePart (a stream sink > results, a tee target, a with/by operand, a head/skip/tail count) and the by step of a forRange (statement and stream-source forms). The last two were unchecked until 2026-10-07 and compiled clean into a NullPointerException or a silent misread (absence families A and B, docs/language-design/EK9_ABSENCE_UNOBSERVABLE.md).

Properties are not judged here - IdentifierAsPropertyOrError sees every identifier and reports E08060. Which positions are reads, and which consumer checks each, is pinned by ReadPositionGateTest: a new grammar rule with an identifier child is red until it is classified.

  • Constructor Details

  • Method Details

    • accept

      public void accept(org.antlr.v4.runtime.ParserRuleContext readNode)
      Check the read at this node.
      Specified by:
      accept in interface Consumer<org.antlr.v4.runtime.ParserRuleContext>
      Parameters:
      readNode - the node phase 3 recorded the read symbol against; null (an absent optional child) is ignored.