Class CastInstrAsmGenerator

java.lang.Object
org.ek9lang.compiler.backend.jvm.AbstractAsmGenerator
org.ek9lang.compiler.backend.jvm.CastInstrAsmGenerator
All Implemented Interfaces:
Consumer<CastInstr>

final class CastInstrAsmGenerator extends AbstractAsmGenerator implements Consumer<CastInstr>
Specialized ASM generator for CastInstr processing.

Generates JVM CHECKCAST instruction for explicit type casting, or INSTANCEOF instruction for type checking. Used in Scenario 2 wrappers where delegate method returns Any but wrapper method returns a more specific type, and for wrapper equality operations that need to detect wrapper-to-wrapper comparison.

  • Constructor Details

  • Method Details

    • accept

      public void accept(CastInstr castInstr)
      Generate JVM bytecode for a cast instruction.

      Loads the source value, applies CHECKCAST or INSTANCEOF to target type, and stores result. For INSTANCEOF, the result is an int (0 or 1) stored with ISTORE.

      Specified by:
      accept in interface Consumer<CastInstr>