Class ExpressionIsBooleanResultOrError
java.lang.Object
org.ek9lang.compiler.common.RuleSupport
org.ek9lang.compiler.common.TypedSymbolAccess
org.ek9lang.compiler.phase3.ExpressionIsBooleanResultOrError
- All Implemented Interfaces:
BiConsumer<EK9Parser.ExpressionContext, String>
final class ExpressionIsBooleanResultOrError
extends TypedSymbolAccess
implements BiConsumer<EK9Parser.ExpressionContext, String>
Checks that an expression resolves to a result of the exact type Boolean, emitting
ONLY_COMPATIBLE_WITH_BOOLEAN otherwise. The statement word (for example 'assert' or 'require')
is woven into the error message so the same check serves each boolean-result statement.
Tolerant of the developer's code being in error: if the expression has no recorded symbol or no resolved type yet (other errors will already have been emitted), nothing is reported here.
-
Field Summary
Fields inherited from class RuleSupport
errorListener, symbolsAndScopes -
Constructor Summary
ConstructorsConstructorDescriptionExpressionIsBooleanResultOrError(SymbolsAndScopes symbolsAndScopes, ErrorListener errorListener) -
Method Summary
Modifier and TypeMethodDescriptionvoidaccept(EK9Parser.ExpressionContext expression, String statementWord) Methods inherited from class TypedSymbolAccess
getRecordedAndTypedSymbol, isProcessingScopePure, recordATypedSymbolMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface BiConsumer
andThen
-
Constructor Details
-
ExpressionIsBooleanResultOrError
ExpressionIsBooleanResultOrError(SymbolsAndScopes symbolsAndScopes, ErrorListener errorListener)
-
-
Method Details
-
accept
- Specified by:
acceptin interfaceBiConsumer<EK9Parser.ExpressionContext, String>
-