Class DispatchTablePass

java.lang.Object
org.ek9lang.compiler.phase7.DispatchTablePass

final class DispatchTablePass extends Object
THE shared "Pass 3" that prepends a DISPATCH_TABLE to every dispatcher operation of an aggregate.

Extracted from the create-operations loops in AggregateDfnGenerator, ServiceDfnGenerator and Scenario3SourceIRGenerator — each builds OperationInstrs and wires dispatcher implementations, but only the first two ever generated a table. The Scenario 3 copy silently omitted it, so a dispatcher inside a monomorphized generic class dispatched every call to its fallback body at runtime (finding Scenario3SourceIRGenerator:415). Call this after the operation bodies are populated.

Fails loud (rather than silently skipping, finding AggregateDfnGenerator:353) when a dispatcher is present but no compilable-program access is available: a dispatch table cannot be built without it (ConcreteSubtypeFinder needs the program), and a silent skip is a runtime miscompilation. The wrapper-generation IRContext must therefore carry program access — see IRGenerator.generateParameterizedTypeWrappers.