Class ControlIsBooleanOrError
java.lang.Object
org.ek9lang.compiler.common.RuleSupport
org.ek9lang.compiler.common.TypedSymbolAccess
org.ek9lang.compiler.phase3.ControlIsBooleanOrError
- All Implemented Interfaces:
Consumer<EK9Parser.ExpressionContext>
final class ControlIsBooleanOrError
extends TypedSymbolAccess
implements Consumer<EK9Parser.ExpressionContext>
Checks that an expression used as a control (if/else if, while, do/while, a ternary) is a condition: a Boolean,
or a type that promotes to one with '#^'. If not emits an error.
isCondition(ISymbol, ISymbol) is THE rule for what a condition may be; assert and require use it too
(ExpressionIsBooleanResultOrError). Phase 7 inserts the promotion (phase7.support.BooleanCondition).
Front-end rationalisation D1 (Steve, 2026-10-02): before it the controls accepted a promotable type and phase 7
never promoted it (a VerifyError at load), while assert and require demanded exactly Boolean.
-
Field Summary
Fields inherited from class RuleSupport
errorListener, symbolsAndScopes -
Constructor Summary
ConstructorsConstructorDescriptionControlIsBooleanOrError(SymbolsAndScopes symbolsAndScopes, ErrorListener errorListener) -
Method Summary
Modifier and TypeMethodDescriptionvoid(package private) static booleanisCondition(ISymbol type, ISymbol booleanType) True if a value of this type can be a condition: a Boolean, or a type that promotes to Boolean with '#^'.Methods inherited from class TypedSymbolAccess
emitTypeNotResolvedError, getRecordedAndTypedSymbol, isProcessingScopePure, recordATypedSymbol
-
Constructor Details
-
ControlIsBooleanOrError
ControlIsBooleanOrError(SymbolsAndScopes symbolsAndScopes, ErrorListener errorListener)
-
-
Method Details
-
accept
- Specified by:
acceptin interfaceConsumer<EK9Parser.ExpressionContext>
-
isCondition
-