Class ApplyAllowingOnlyOrError

java.lang.Object
org.ek9lang.compiler.common.RuleSupport
org.ek9lang.compiler.phase2.ApplyAllowingOnlyOrError
All Implemented Interfaces:
BiConsumer<EK9Parser.AllowingOnlyContext, AggregateWithTraitsSymbol>

final class ApplyAllowingOnlyOrError extends RuleSupport implements BiConsumer<EK9Parser.AllowingOnlyContext, AggregateWithTraitsSymbol>
Resolves each class in an 'allowingOnly' list (checking it is a suitable CLASS genus) and registers it as an allowed extender of the supplied aggregate. A concrete (non-abstract) class is required - an abstract class triggers ABSTRACT_IN_ALLOW_ONLY. A null allowingOnly is tolerated (nothing to add).

Centralises the resolve-each-allowed-class loop shared by trait declarations and (sealed) class declarations. The class-only SEALED_CLASS_MUST_BE_OPEN precondition stays at its caller.