Class LiteralInstr

java.lang.Object
org.ek9lang.compiler.ir.instructions.IRInstr
org.ek9lang.compiler.ir.instructions.LiteralInstr
All Implemented Interfaces:
INode

public final class LiteralInstr extends IRInstr
IR instruction for loading literal/constant values. Handles string literals, numeric literals, boolean literals, etc. Uses symbol-driven approach to get correct type information.
  • Method Details

    • objectFromLiteral

      public static LiteralInstr objectFromLiteral(String result, String literalValue, String literalType, DebugInfo debugInfo)
      Create instruction to load a literal value as an EK9 object.

      This creates an actual EK9 object (Integer, String, Boolean, etc.) from the literal representation - not a raw primitive value.

      Parameters:
      result - Variable to store the created object
      literalValue - The literal value as string
      literalType - The resolved type name (could be decorated)
      debugInfo - Debug information for source mapping (can be null)
      Returns:
      LiteralInstruction for creating the object from literal
    • objectFromLiteral

      public static LiteralInstr objectFromLiteral(String result, String literalValue, String literalType)
    • getLiteralValue

      public String getLiteralValue()
      Get the literal value.
    • getLiteralType

      public String getLiteralType()
      Get the literal type (could be decorated for generic contexts).