Record Class DebugInfo

java.lang.Object
java.lang.Record
org.ek9lang.compiler.ir.DebugInfo

public record DebugInfo(String sourceFile, int lineNumber, int columnNumber, String originalText) extends Record
Debug information for IR instructions to enable source mapping and debugging. Contains original source file location information extracted from ISymbol source tokens.
  • Constructor Summary

    Constructors
    Constructor
    Description
    DebugInfo(String sourceFile, int lineNumber, int columnNumber, String originalText)
    Compact constructor with validation.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Returns the value of the columnNumber record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    static DebugInfo
    from(CompilableSource compilableSource, ISymbol symbol)
    Create DebugInfo from an ISymbol's source token.
    final int
    Returns a hash code value for this object.
    boolean
    Check if this debug info represents a valid source location.
    int
    Returns the value of the lineNumber record component.
    static DebugInfo
    of(String sourceFile, int lineNumber, int columnNumber)
    Create DebugInfo with just file and position (no original text).
    Returns the value of the originalText record component.
    Returns the value of the sourceFile record component.
    Format debug info as IR comment for output.
    final String
    Returns a string representation of this record class.

    Methods inherited from class java.lang.Object

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

    • DebugInfo

      public DebugInfo(String sourceFile, int lineNumber, int columnNumber, String originalText)
      Compact constructor with validation.
  • Method Details

    • from

      public static DebugInfo from(CompilableSource compilableSource, ISymbol symbol)
      Create DebugInfo from an ISymbol's source token. Returns null if the symbol has no source token information. Uses filename only (without path) for portability and consistency with EK9 error reporting.
    • of

      public static DebugInfo of(String sourceFile, int lineNumber, int columnNumber)
      Create DebugInfo with just file and position (no original text).
    • toIRComment

      public String toIRComment()
      Format debug info as IR comment for output. Example: "// workarea.ek9:12:15"
    • isValidLocation

      public boolean isValidLocation()
      Check if this debug info represents a valid source location.
    • 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. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      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.
    • sourceFile

      public String sourceFile()
      Returns the value of the sourceFile record component.
      Returns:
      the value of the sourceFile record component
    • lineNumber

      public int lineNumber()
      Returns the value of the lineNumber record component.
      Returns:
      the value of the lineNumber record component
    • columnNumber

      public int columnNumber()
      Returns the value of the columnNumber record component.
      Returns:
      the value of the columnNumber record component
    • originalText

      public String originalText()
      Returns the value of the originalText record component.
      Returns:
      the value of the originalText record component