Class DispatcherHandlers

java.lang.Object
org.ek9lang.compiler.support.DispatcherHandlers

public final class DispatcherHandlers extends Object
THE single source of truth for the handler set of a dispatcher entry point.

A dispatcher method (marked as dispatcher) routes each call to the most specific matching handler — a same-named overload with the same arity. The handler set is drawn from the FULL inheritance chain (IAggregateSymbol.getAllMethods()), because a concrete class commonly overrides an abstract entry point as dispatcher while inheriting all the typed handlers from its supertypes (e.g. Intersector extends SpecialIntersector in DispatcherClass.ek9).

Phase 5 (DispatcherAmbiguityOrError, the "no two handlers tie at equal cost" check) and phase 7 (DispatchTableGenerator, which records the winning handler per concrete type) MUST use this exact set — otherwise phase 5's "no ambiguity" guarantee does not transfer to the set phase 7 actually dispatches over, and inherited handlers silently drop to the fallback body at runtime. Do not re-derive a variant of this filter.

  • Method Details

    • collectFor

      public static List<MethodSymbol> collectFor(IAggregateSymbol aggregate, MethodSymbol dispatcher)
      The handlers for dispatcher on aggregate: every non-abstract, non-constructor, non-operator, non-dispatcher method across the inheritance chain with the same name and arity.