Record Class DeclarationParts

java.lang.Object
java.lang.Record
org.ek9lang.compiler.phase7.generator.DeclarationParts
Record Components:
declaration - the declarations, in order
initialisation - the value production, in order

public record DeclarationParts(List<IRInstr> declaration, List<IRInstr> initialisation) extends Record
A variable declaration's instructions as its two halves, known where they are generated: the DECLARATION (the variable's slot, and any declaration that must outlive the evaluation with it) and the INITIALISATION (everything else - the value production). THE structured split (FLOW-14a): a try expression relocates the initialisation of its returning variable into its guarded body by these halves, never by scanning the generated IR's opcodes.
  • Constructor Details

    • DeclarationParts

      public DeclarationParts(List<IRInstr> declaration, List<IRInstr> initialisation)
      Creates an instance of a DeclarationParts record class.
      Parameters:
      declaration - the value for the declaration record component
      initialisation - the value for the initialisation record component
  • Method Details

    • all

      public List<IRInstr> all()
      The whole declaration: the declaration, then the initialisation.
    • 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.
    • declaration

      public List<IRInstr> declaration()
      Returns the value of the declaration record component.
      Returns:
      the value of the declaration record component
    • initialisation

      public List<IRInstr> initialisation()
      Returns the value of the initialisation record component.
      Returns:
      the value of the initialisation record component