Class ScopeInstr

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

public final class ScopeInstr extends IRInstr
Specialized IR instruction for scope management (SCOPE_ENTER, SCOPE_EXIT, SCOPE_REGISTER).

Scope instructions provide exception-safe memory management for EK9, via ARC.

  • Method Details

    • enter

      public static ScopeInstr enter(String scopeId)
      Create scope enter instruction: SCOPE_ENTER scope_id. Establishes a new memory management scope for exception safety.
    • enter

      public static ScopeInstr enter(String scopeId, DebugInfo debugInfo)
      Create scope enter instruction with debug info: SCOPE_ENTER scope_id.
    • exit

      public static ScopeInstr exit(String scopeId)
      Create scope exit instruction: SCOPE_EXIT scope_id. Automatically RELEASE all objects registered in this scope.
    • exit

      public static ScopeInstr exit(String scopeId, DebugInfo debugInfo)
      Create scope exit instruction with debug info: SCOPE_EXIT scope_id.
    • register

      public static ScopeInstr register(String object, String scopeId)
      Create scope register instruction: SCOPE_REGISTER object, scope_id Register object for automatic cleanup when scope exits.
    • register

      public static ScopeInstr register(String object, String scopeId, DebugInfo debugInfo)
      Create scope register instruction with debug info: SCOPE_REGISTER object, scope_id.
    • addOperand

      public ScopeInstr addOperand(String operand)
      Description copied from class: IRInstr
      Add operand to this instruction.
      Overrides:
      addOperand in class IRInstr
    • addOperands

      public ScopeInstr addOperands(String... operands)
      Description copied from class: IRInstr
      Add multiple operands to this instruction.
      Overrides:
      addOperands in class IRInstr
    • getScopeId

      public String getScopeId()
      Get scope ID for this scope instruction.
    • getObject

      public String getObject()
      Get object name for SCOPE_REGISTER instructions.