Class UnsetKeepingOperator
java.lang.Object
org.ek9lang.compiler.support.UnsetKeepingOperator
🔑 THE question "does this in-place operator keep an UNSET receiver unset?" - asked of the RESOLVED operator symbol,
never of its spelling or the receiver's type name. True only for an operator carrying
KEEPS_UNSET, which the
bootstrap squirrels from @Ek9Operator(keepsUnset = true) (+= -= *= /= ++ -- on the literal types;
pinned by ek9-lang UnsetFactsTest). A user operator never carries it, so for a user type the answer is
always no and the value tracker forgets the value exactly as before.
The search is the one phase 3 made when it resolved the operator (LhsAndRhsAssignmentOrError,
StatementOrError): the operator by its written name, with the argument's type when it has one. Phase 3
records nothing for these operators, so a later phase asks here rather than re-deriving the search.
-
Method Summary
Modifier and TypeMethodDescriptionstatic Optional<MethodSymbol> keepingUnset(ISymbol receiverType, String operator, Optional<ISymbol> argumentType) Asresolve(ISymbol, String, Optional)thenkeepsUnset(MethodSymbol): the resolved operator, only when it keeps an unset receiver unset.static booleankeepsUnset(MethodSymbol operator) Does the resolved operator keep an unset receiver unset, whatever its argument?static Optional<MethodSymbol> The operatoroperatorresolves to onreceiverTypegiven an argument ofargumentType(empty for++and--), when it resolves to exactly one.
-
Method Details
-
resolve
-
keepsUnset
Does the resolved operator keep an unset receiver unset, whatever its argument? -
keepingUnset
public static Optional<MethodSymbol> keepingUnset(ISymbol receiverType, String operator, Optional<ISymbol> argumentType) Asresolve(ISymbol, String, Optional)thenkeepsUnset(MethodSymbol): the resolved operator, only when it keeps an unset receiver unset.
-