Class IsConvertableToStringOrError
java.lang.Object
org.ek9lang.compiler.common.RuleSupport
org.ek9lang.compiler.phase3.IsConvertableToStringOrError
- All Implemented Interfaces:
BiPredicate<IToken,ISymbol>
Checks if a type has the $ 'toString' method or a 'promotion' #^ to a String method.
If not emits an error. Or it must be the String type itself.
Also sets the appropriate conversion flags on the ExpressionSymbol if provided.
-
Field Summary
Fields inherited from class RuleSupport
errorListener, symbolsAndScopes -
Constructor Summary
ConstructorsConstructorDescriptionIsConvertableToStringOrError(SymbolsAndScopes symbolsAndScopes, ErrorListener errorListener) Constructor to provided typed access. -
Method Summary
Modifier and TypeMethodDescriptionboolean(package private) booleantestAndSetFlags(IToken errorReportingLocation, ISymbol typeSymbol, ExpressionSymbol expressionSymbol) Test if the type can be converted to String and optionally set flags on the expression symbol.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface BiPredicate
and, negate, or
-
Constructor Details
-
IsConvertableToStringOrError
IsConvertableToStringOrError(SymbolsAndScopes symbolsAndScopes, ErrorListener errorListener) Constructor to provided typed access.
-
-
Method Details
-
test
-
testAndSetFlags
boolean testAndSetFlags(IToken errorReportingLocation, ISymbol typeSymbol, ExpressionSymbol expressionSymbol) Test if the type can be converted to String and optionally set flags on the expression symbol.- Parameters:
errorReportingLocation- Location for error reportingtypeSymbol- The type to checkexpressionSymbol- Optional expression symbol to set conversion flags on- Returns:
- true if type is already String or has $ operator, false if promotion is needed
-