Class CallInstr

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

public final class CallInstr extends IRInstr
Specialized IR instruction for method calls (CALL, CALL_VIRTUAL, CALL_STATIC, CALL_DISPATCHER).

This instruction type handles ALL EK9 method calls and operators. EK9 operators like a + b become method calls like a._add(b).

  • Method Details

    • call

      public static CallInstr call(String result, DebugInfo debugInfo, CallDetails callDetails)
      Create method call with complete type information from resolved symbols: CALL result = object.method(args...)
    • callStatic

      public static CallInstr callStatic(String result, DebugInfo debugInfo, CallDetails callDetails)
      Create static method call with complete type information: CALL_STATIC result = Type.method(args...)
    • callStatic

      public static CallInstr callStatic(VariableDetails variableDetails, CallDetails callDetails)
    • operator

      public static CallInstr operator(String result, DebugInfo debugInfo, CallDetails callDetails)
      Create EK9 operator call with complete type information: CALL result = object._operatorMethod(args...) Common operators: _add, _sub, _eq, _lt, _addAss, _isSet, etc.
    • operator

      public static CallInstr operator(VariableDetails variableDetails, CallDetails callDetails)
    • constructor

      public static CallInstr constructor(String result, DebugInfo debugInfo, CallDetails callDetails)
      Create constructor call with complete type information: CALL result = Type.<init>(args...)
    • accept

      public void accept(INodeVisitor visitor)
      Specified by:
      accept in interface INode
      Overrides:
      accept in class IRInstr
    • getTargetObject

      public String getTargetObject()
    • getMethodName

      public String getMethodName()
    • getArguments

      public List<String> getArguments()
    • isConstructorCall

      public boolean isConstructorCall()
      Check if this is a constructor call.
    • getTargetTypeName

      public String getTargetTypeName()
      Get the EK9 format target type name (e.g., "org.ek9.lang::Stdout").
    • getParameterTypes

      public List<String> getParameterTypes()
      Get parameter type names in EK9 format (e.g., ["org.ek9.lang::String"]).
    • getReturnTypeName

      public String getReturnTypeName()
      Get return type name in EK9 format (e.g., "org.ek9.lang::Void").
    • isTraitCall

      public boolean isTraitCall()
      Check if this is a trait call (requires invokeinterface in JVM bytecode).
    • isExplicitTraitDefaultCall

      public boolean isExplicitTraitDefaultCall()
      Check if this is an explicit trait default method call (TraitName.method() syntax). These calls require invokespecial in JVM bytecode to call the interface's default method directly, bypassing virtual dispatch.