Class RetentionRoutes

java.lang.Object
org.ek9lang.compiler.support.sharing.RetentionRoutes

public final class RetentionRoutes extends Object
THE table of every grammar position that can hold a value, and what the phase-5 RETAINS derivation does with it (the derivation audit's §2 and §6, docs/implementation/memory-optimisation-2026-11-12/DERIVATION_AUDIT.md). Use this; never a second list of "the routes a value can take". Hold one.

A SLOT is a (parser parent context, child accessor) pair - for example ThrowStatementContext.identifierReference - whose accessor returns one of the value-bearing context types (the test lists them). The derivation reads a value from the occurrence of a name UP the parse tree (ObjectSharing, RetainedBy, CallableParameterOccurrences, ReturnSourceOrigins), so a position it never reads is silently "keeps nothing" - which is how throw p stayed missed (audit M1). RetentionRoutesClassifiedTest enumerates the slots from the generated EK9Parser by reflection and fails on any slot this table does not name (and any entry the parser no longer has), so a grammar change cannot add a position silently.

Every slot is exactly one RetentionRoutes.Route: RetentionRoutes.Route.SEEN (the derivation reads it - the reason names the class and method that do), RetentionRoutes.Route.CONSERVATIVE (read, and over-states), RetentionRoutes.Route.NOT_A_HOLDING_ROUTE (can never make one value held by another or leave the callable - the reason says why), or RetentionRoutes.Route.DEFERRED (a known miss: the audit item - M3, U1, K1 - or an UNREVIEWED doubt a person must decide). A fix that lands must move its row.

  • Field Details

    • UNREVIEWED

      public static final String UNREVIEWED
      The start of the reason of a doubt nobody has decided yet.
      See Also:
  • Constructor Details

    • RetentionRoutes

      public RetentionRoutes()
      Builds THE table.
  • Method Details