Class DelegateLoad

java.lang.Object
org.ek9lang.compiler.phase7.support.DelegateLoad

public final class DelegateLoad extends Object
THE load of a wrapper's delegate field, borrowed for the scope - shared by the constrained types (ConstrainedTypeInstrs) and the Scenario-2 wrappers (Scenario2WrapperHelper), which each had a byte-identical private copy (DFN-3, MONO-8). Hold one and use it; never hand-write the LOAD_FIELD and its borrow.
  delegateVar = LOAD_FIELD objectVar.delegate (ownerType -> delegateType)
  borrowed in scopeId (OwnershipStatements.borrowInScope(String, String, DebugInfo))
  • Constructor Details

    • DelegateLoad

      public DelegateLoad()
  • Method Details

    • borrowed

      public String borrowed(List<IRInstr> instructions, Supplier<String> newTemp, String objectVar, String ownerType, String delegateType, String scopeId, DebugInfo debugInfo)
      Load objectVar.delegate into a new temporary, borrowed for scopeId.
      Parameters:
      instructions - the list to append to
      newTemp - the generation's temporary namer (called once, before the load)
      objectVar - the wrapper value
      ownerType - the wrapper's type (the field's owner)
      delegateType - the delegate field's type
      scopeId - the scope that borrows the delegate
      debugInfo - debug information
      Returns:
      the temporary holding the delegate