Class ObjectAccessChain

java.lang.Object
org.ek9lang.compiler.support.ObjectAccessChain

public final class ObjectAccessChain extends Object
THE shared structural analysis for an objectAccessExpression chain — use this, do not re-derive the walk.

Grammar:

objectAccessExpression : objectAccessStart objectAccess
objectAccess           : objectAccessType objectAccess?   // RECURSIVE
objectAccessType       : DOT (identifier | operationCall)

Used both by phase 3 (AssignmentStatementOrError, to reject a simple/guarded assignment whose target is a method-call result — E07895) and by phase 7 (AssignmentStmtGenerator, to route a mutating-operator assignment on a call result to the correct lowering). Keeping the walk in one place prevents the two from drifting.

  • Method Details

    • endsWithOperationCall

      public static boolean endsWithOperationCall(EK9Parser.ObjectAccessExpressionContext ctx)
      True when the final step of the object-access chain is a method/operation call rather than a plain field identifier — e.g. repository.items() (ends in a call) versus config.host (ends in a field). A chain ending in a call has no field lvalue to STORE to; only a mutating operator (which mutates the object the call returns) is meaningful on it.