Enum Class ReturnSourceKind

java.lang.Object
java.lang.Enum<ReturnSourceKind>
org.ek9lang.compiler.phase5.ReturnSourceKind
All Implemented Interfaces:
Serializable, Comparable<ReturnSourceKind>, Constable

enum ReturnSourceKind extends Enum<ReturnSourceKind>
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:

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.

  • Enum Constant Details

    • NEW

      public static final ReturnSourceKind NEW
      A new object: a constructor call, or a call whose declared closeable return is new by R5 itself.
    • RECEIVER_INTERIOR

      public static final ReturnSourceKind RECEIVER_INTERIOR
      this, super, a property or a view of one.
    • CAPTURE

      public static final ReturnSourceKind CAPTURE
      A variable the enclosing dynamic function or class captured.
    • PARAMETER

      public static final ReturnSourceKind PARAMETER
      An incoming parameter: the caller owns it.
    • LOCAL

      public static final ReturnSourceKind LOCAL
      A local variable, including a try-with-resources resource: closed when its owner ends.
    • ALIASING_CALL

      public static final ReturnSourceKind ALIASING_CALL
      A call whose RETAINS says its result may be its receiver's interior or an argument.
    • UNKNOWN

      public static final ReturnSourceKind UNKNOWN
      Anything else: not provably new.
  • Method Details

    • values

      public static ReturnSourceKind[] 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

      public static ReturnSourceKind valueOf(String name)
      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 name
      NullPointerException - 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 in
      callable - the method, operator, function or dynamic function whose returning variable it is
      source - the expression the returning variable is made to refer to