Enum Class ReturnSourceKind
- All Implemented Interfaces:
Serializable, Comparable<ReturnSourceKind>, Constable
THE classification of what a callable's returning variable is made to refer to - one of the
MutatedOnlyVariables.ReturningCallable.sources() collected in Walk 1. Both consumers read it, so they cannot
disagree about a source:
ReceiverInteriorReturnsderivesRETAINS return <- receiver-interiorfromviewsReceiver();CloseableReturnOrError(R5, E81057) requires every source of a closeable-returning callable to beNEW.
Classification is purely syntactic over the recorded symbols, and reads other callables' RETAINS marks, so it is evaluated afresh on every pass of the derivation's fixpoint.
-
Nested Class Summary
Nested classes/interfaces inherited from class Enum
Enum.EnumDesc<E> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionA call whose RETAINS says its result may be its receiver's interior or an argument.A variable the enclosing dynamic function or class captured.A local variable, including a try-with-resources resource: closed when its owner ends.A new object: a constructor call, or a call whose declared closeable return is new by R5 itself.An incoming parameter: the caller owns it.this,super, a property or a view of one.Anything else: not provably new. -
Method Summary
Modifier and TypeMethodDescription(package private) StringHow the source is named in a diagnostic.(package private) static ReturnSourceKindof(ParsedModule parsedModule, ScopedSymbol callable, EK9Parser.ExpressionContext source) Classify one source of a callable's returning variable.static ReturnSourceKindReturns the enum constant of this class with the specified name.static ReturnSourceKind[]values()Returns an array containing the constants of this enum class, in the order they are declared.(package private) booleanIs the source (part of) the receiver - a property, a view of one, or a capture held in a field.
-
Enum Constant Details
-
NEW
A new object: a constructor call, or a call whose declared closeable return is new by R5 itself. -
RECEIVER_INTERIOR
this,super, a property or a view of one. -
CAPTURE
A variable the enclosing dynamic function or class captured. -
PARAMETER
An incoming parameter: the caller owns it. -
LOCAL
A local variable, including a try-with-resources resource: closed when its owner ends. -
ALIASING_CALL
A call whose RETAINS says its result may be its receiver's interior or an argument. -
UNKNOWN
Anything else: not provably new.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
description
String description()How the source is named in a diagnostic. -
viewsReceiver
boolean viewsReceiver()Is the source (part of) the receiver - a property, a view of one, or a capture held in a field. -
of
static ReturnSourceKind of(ParsedModule parsedModule, ScopedSymbol callable, EK9Parser.ExpressionContext source) Classify one source of a callable's returning variable.- Parameters:
parsedModule- the module the source was parsed incallable- the method, operator, function or dynamic function whose returning variable it issource- the expression the returning variable is made to refer to
-