Record Class ForRangePolymorphicInstr.EndCheck

java.lang.Object
java.lang.Record
org.ek9lang.compiler.ir.instructions.ForRangePolymorphicInstr.EndCheck
Enclosing class:
ForRangePolymorphicInstr

public static record ForRangePolymorphicInstr.EndCheck(String primitive, DebugInfo debugInfo) extends Record
Whether the counter has REACHED the end: primitive is read after the body, and the loop stops BEFORE the increment when it is true. It is computed at the TOP of the iteration by the loop_condition_template, from the very counter <=> end the loop condition uses (one comparison per step, Contract 15) - there is no evaluation of its own. The range never steps past its end, so the counter never takes a value after the end (a constraint, or the type's maximum, need not hold one).

debugInfo is the for statement's position (null when debugging instrumentation is off): the end test is on the for line, so a back end gives the read of primitive that line. With no line of its own it would take the last body line's, and a debugger would leave the loop from the last pass's body instead of stopping on the for line once more (Contract 15).

  • Constructor Summary

    Constructors
    Constructor
    Description
    EndCheck(String primitive, DebugInfo debugInfo)
    Creates an instance of a EndCheck record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    (package private) String
    The end_primitive line of the IR text, with the for statement's position when there is one.
    Returns the value of the debugInfo record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    Returns the value of the primitive record component.
    final String
    Returns a string representation of this record class.

    Methods inherited from class Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • EndCheck

      public EndCheck(String primitive, DebugInfo debugInfo)
      Creates an instance of a EndCheck record class.
      Parameters:
      primitive - the value for the primitive record component
      debugInfo - the value for the debugInfo record component
  • Method Details

    • asIrLine

      String asIrLine()
      The end_primitive line of the IR text, with the for statement's position when there is one.
    • 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.
    • primitive

      public String primitive()
      Returns the value of the primitive record component.
      Returns:
      the value of the primitive record component
    • debugInfo

      public DebugInfo debugInfo()
      Returns the value of the debugInfo record component.
      Returns:
      the value of the debugInfo record component