Record Class StoreSite

java.lang.Object
java.lang.Record
org.ek9lang.compiler.phase5.StoreSite
Record Components:
target - the variable, property or returning variable stored into.
value - the expression whose value is stored.
location - where a rule about this store is reported (the declared name, or the assignment operator).

record StoreSite(ISymbol target, EK9Parser.AssignmentExpressionContext value, IToken location) extends Record
THE phase-5 reading of a STORE: a statement that makes a variable, property or returning variable refer to the value an expression evaluates to. Use it wherever a rule must judge the VALUE stored rather than the slot's DECLARED type - a store into a broader declared type (x as IO: HTTP(), s as Server: HTTP()) erases the value's type from the slot, so a rule keyed on the slot is escaped by it.

A store is a declaration with an initialiser (<-, :=, =, :; never :~:, which merges into a new object) or a pointer assignment (:=, =, :, :=?, as ReferenceAssignment.repointsTarget(EK9Parser.AssignmentStatementContext) reads it) to a name or through an object access. An in-place operator hands the value to the target's operator and stores no reference. An ARGUMENT is not a store.

Shared by R7, closeability cannot be erased by a store (E81059, CloseableErasedByStoreOrError), and the program HTTP linkage rule (E12020-E12023, ProgramHttpWiringOrError), which had the same erasure hole. Unlike ReferenceAssignment (locals only, for alias-following checks) a store to a property counts.

  • Constructor Details

  • Method Details

    • of

      The store a declaration with an initialiser makes, if it makes one.
    • of

      The store a pointer assignment to an existing variable or property makes, if it makes one.
    • valueType

      Optional<ISymbol> valueType(SymbolsAndScopes symbolsAndScopes)
      The resolved type of the value stored - not the slot's declared type.
    • storesExistingReference

      boolean storesExistingReference()
      True when the value is just another name for an existing object (b <- a): the store copies a reference and creates nothing.
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • target

      public ISymbol target()
      Returns the value of the target record component.
      Returns:
      the value of the target record component
    • value

      Returns the value of the value record component.
      Returns:
      the value of the value record component
    • location

      public IToken location()
      Returns the value of the location record component.
      Returns:
      the value of the location record component