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. Hold one and ask it.
The search is OperatorResolvedOn, the one phase 3 made when it resolved the operator
(LhsAndRhsAssignmentOrError, StatementOrError); the test of one resolved operator is
KeepsUnset. Phase 3 records nothing for these operators, so a later phase asks here rather than re-deriving
the search.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionkeepingUnset(ISymbol receiverType, String operator, Optional<ISymbol> argumentType) AsOperatorResolvedOnthenKeepsUnset: the resolved operator, only when it keeps an unset receiver unset.
-
Constructor Details
-
UnsetKeepingOperator
public UnsetKeepingOperator()
-
-
Method Details
-
keepingUnset
public Optional<MethodSymbol> keepingUnset(ISymbol receiverType, String operator, Optional<ISymbol> argumentType) AsOperatorResolvedOnthenKeepsUnset: the resolved operator, only when it keeps an unset receiver unset.- Parameters:
receiverType- the type the operator is resolved onoperator- the operator as writtenargumentType- the argument's type (empty for++and--)- Returns:
- the resolved operator, when it keeps an unset receiver unset
-