Class CompoundConditionOrError
java.lang.Object
org.ek9lang.compiler.common.RuleSupport
org.ek9lang.compiler.common.TypedSymbolAccess
org.ek9lang.compiler.phase5.CompoundConditionOrError
- All Implemented Interfaces:
Consumer<EK9Parser.ExpressionContext>
final class CompoundConditionOrError
extends TypedSymbolAccess
implements Consumer<EK9Parser.ExpressionContext>
Detects tautological and contradictory compound conditions using range algebra (E08086/E08087).
Analyses same-level compound expressions using and/or to detect:
- AND subsumption:
x > 10 and x > 5— x > 5 is redundant (always true) - AND contradiction:
x > 10 and x < 3— impossible, always false - OR tautology:
x > 5 or x <= 5— covers entire domain, always true - OR subsumption:
x > 5 or x > 10— x > 10 is subsumed (redundant)
Only processes the root of an AND/OR chain to avoid duplicate errors on nested nodes.
-
Field Summary
Fields inherited from class RuleSupport
errorListener, symbolsAndScopes -
Constructor Summary
ConstructorsConstructorDescriptionCompoundConditionOrError(SymbolsAndScopes symbolsAndScopes, ErrorListener errorListener, ValueTrackingAnalyzer valueTracker) -
Method Summary
Methods inherited from class TypedSymbolAccess
getRecordedAndTypedSymbol, isProcessingScopePure, recordATypedSymbol
-
Constructor Details
-
CompoundConditionOrError
CompoundConditionOrError(SymbolsAndScopes symbolsAndScopes, ErrorListener errorListener, ValueTrackingAnalyzer valueTracker)
-
-
Method Details
-
accept
- Specified by:
acceptin interfaceConsumer<EK9Parser.ExpressionContext>
-