Class AspectProxyInstr

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

public final class AspectProxyInstr extends IRInstr
High-level IR instruction for creating an aspect-woven proxy.

This instruction tells the backend to generate a synthetic proxy class that wraps a delegate component with ordered aspect instances. The proxy extends the base type and, for each public non-operator method, generates a wrapped version with before/after advice chains.

All instance construction (delegate, aspects, their dependencies) happens via normal CALL/RETAIN/SCOPE_REGISTER instructions before this instruction. This instruction takes the pre-constructed instances and returns a wired proxy.

The backend is responsible for:

  • Generating a proxy class extending baseType
  • Creating fields for delegate and aspect instances
  • For each public non-operator method: JoinPoint creation, before-chain, delegate call (with try/finally), after-chain (reverse order)
  • Proxy naming via source token hash
  • Method Details

    • createAspectProxy

      public static AspectProxyInstr createAspectProxy(AspectProxyDetails details)
      Create an aspect proxy instruction from details.
    • getBaseTypeFqn

      public String getBaseTypeFqn()
    • getDelegateTypeFqn

      public String getDelegateTypeFqn()
    • getDelegateTemp

      public String getDelegateTemp()
    • getAspectTemps

      public List<String> getAspectTemps()
    • getAspectTypeFqns

      public List<String> getAspectTypeFqns()
    • getProxyMethods

      public List<AspectProxyDetails.ProxyMethodInfo> getProxyMethods()
    • forwardsClose

      public boolean forwardsClose()
      True when the proxy forwards _close() to its delegate (the base type has a close operator).
    • implementsCloseable

      public boolean implementsCloseable()
      True when the proxy must implement the Closeable trait (only its delegate has a close).
    • getSourceToken

      public IToken getSourceToken()
    • toString

      public String toString()
      Overrides:
      toString in class IRInstr