Class CallableParameterOccurrences

java.lang.Object
org.ek9lang.compiler.phase5.CallableParameterOccurrences

final class CallableParameterOccurrences extends Object
THE reading of what one callable does with its own parameters (and with each local made to refer to one): every occurrence of such a variable is judged through ObjectSharing.all(EK9Parser.IdentifierContext, Function) and handed to CloseableArgumentKeeping, which decides - after every source is walked - which parameters the callable KEEPS beyond the call. Extracted (the lane callee-keep, 2026-10-21) from CloseableSlotStoreOrError, where D78's verifier wrote it for constructors; a method, operator, function or dynamic function is read by exactly the same step, so what a constructor does with its argument and what a function does with its argument can never be judged by two readings.
  • kept somewhere nothing names (ESCAPES): kept, in ambient;
  • shared with a property: kept, in the receiver (in ambient where there is no receiver - a function's capture); shared with another of the callable's parameters (list += item): kept, in that parameter - it came from the caller and outlives the call;
  • shared with the returning variable: held by what the callable RETURNS - return <- item, as ReceiverInteriorReturns derives for a plain return, here also for a wrapper, a capture or a container the returned value holds; it is not kept BEYOND the result;
  • shared with a local: followed through that local (an alias);
  • given whole to a constructor of the program's own: that constructor's verdict (a forward); to a method or function of the program's own: that callee's verdict, derived in the same fixpoint;
  • a link of a chain, or a call result, whose value cannot hold a closeable (BorrowedViewReturn): nothing is kept.
One instance serves one source's walk (Walk 1 is per source), so its variable table needs no lock.
  • Constructor Details

  • Method Details

    • declared

      void declared(ISymbol recorded)
      A callable declaration was reached: its parameters are the variables whose occurrences are followed.
    • holderOf

      The callable whose own variable this is, when it is one that is followed (a parameter, or a local made to refer to one); empty otherwise.
    • accept

      void accept(EK9Parser.IdentifierContext ctx)
      One occurrence of a variable: does the object it refers to outlive the call?
    • acceptSelf

      void acceptSelf(EK9Parser.PrimaryReferenceContext ctx)
      One this or super in a method or operator: does the RECEIVER outlive the call? (D80 follow-up, 2026-10-21.) The object a method runs on is read exactly as a parameter's object is - this is not an identifier, so ObjectSharing.all(EK9Parser.IdentifierContext, Function) never saw it, and items += this was a method that kept nothing. A call of the program's own method on it (this.register(items), super.register(items)) is the receiver passed on: kept when that method keeps ITS receiver.
    • acceptImplicitSelfCall

      void acceptImplicitSelfCall(EK9Parser.CallContext ctx)
      A call written with no receiver that runs one of the program's own methods (register(items)): the receiver is the object the calling method runs on, passed on as this.register(items) would be.