Class ListLiteralInstr

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

public final class ListLiteralInstr extends IRInstr
IR instruction for list literal construction with pre-sized allocation.

Contains structured data for building a list from pre-evaluated element temps. All element expressions have been evaluated into temp variables by Phase 7 before this instruction is created.

Backends can choose optimal construction strategy:

  • JVM: new ArrayList(N) + per-element _addAss()
  • LLVM: single allocation with known size
  • Method Details

    • create

      public static ListLiteralInstr create(String result, List<IRInstr> setupInstructions, ListLiteralDetails details, String scopeId, DebugInfo debugInfo)
      Create a list literal instruction.
      Parameters:
      result - Variable to store the resulting List
      setupInstructions - Instructions to evaluate elements and manage memory
      details - List literal details (type, element temps, count)
      scopeId - Scope for memory management
      debugInfo - Source location information
      Returns:
      ListLiteralInstr
    • getSetupInstructions

      public List<IRInstr> getSetupInstructions()
      Get the setup instructions (element evaluation + memory management).
    • getDetails

      public ListLiteralDetails getDetails()
      Get the list literal details.
    • getScopeId

      public String getScopeId()
      Get the scope ID for memory management.
    • toString

      public String toString()
      Overrides:
      toString in class IRInstr