Class BindingRecurse


public class BindingRecurse extends Expression
Loops back to the beginning of the named binding, updating each of the binding variables to have new values. There are two ways to provide values for the recursion:
  • Provide an expression for each variable defined in the binding in the same order as they are defined in the binding.
  • Provide a list of binding pairs containing the variables to be updates and their new values. This can be handy if the binding has many variables and only a few need to be updated when recursing.
  • Field Details

    • name

      public final String name
      The name of the binding to recurse back to
    • bindingType

      public final Type bindingType
      The return type of the binding being recursed to
    • nextValues

      public final Expression[] nextValues
      The expressions for each binding variable in the binding being recursed to
    • bindingPairs

      public final Binding.BindingPair[] bindingPairs
      The bindings specifying which values in the binding should be updated
  • Constructor Details

    • BindingRecurse

      public BindingRecurse(String name, Type bindingType, Expression[] nextValues)
      Create a binding recurse expression providing new values for each bound variable
      Parameters:
      name - The name of the binding to recurse to
      bindingType - The return type of the binding being recursed to
      nextValues - The new values for each of the binding's variables
    • BindingRecurse

      public BindingRecurse(String name, Type bindingType, Expression[] nextValues, String filename, int lineNumber)
      Create a binding recurse expression providing new values for each bound variable
      Parameters:
      name - The name of the binding to recurse to
      bindingType - The return type of the binding being recursed to
      nextValues - The new values for each of the binding's variables
      filename - The source filename this expression is associated with
      lineNumber - The source line number this expression is associated with
    • BindingRecurse

      public BindingRecurse(String name, Type bindingType, Binding.BindingPair[] bindingPairs)
      Create a binding recurse expression providing binding pairs for the variables that should be updated
      Parameters:
      name - The name of the binding to recurse to
      bindingType - The return type of the binding being recursed to
      bindingPairs - The binding pairs containing the new values for some variables in the binding.
    • BindingRecurse

      public BindingRecurse(String name, Type bindingType, Binding.BindingPair[] bindingPairs, String filename, int lineNumber)
      Create a binding recurse expression providing binding pairs for the variables that should be updated
      Parameters:
      name - The name of the binding to recurse to
      bindingType - The return type of the binding being recursed to
      bindingPairs - The binding pairs containing the new values for some variables in the binding.
      filename - The source filename this expression is associated with
      lineNumber - The source line number this expression is associated with
  • Method Details

    • getType

      public Type getType()
      Description copied from class: Expression
      Get the type returned by this expression
      Specified by:
      getType in class Expression
      Returns:
      The type of this expression
    • reset

      public void reset()
      Description copied from class: Expression
      Resets any labels in expressions so that the method can be regenerated
      Overrides:
      reset in class Expression
    • findCaptured

      public void findCaptured(Environment env)
      Description copied from class: Expression
      Search for local variables that would be captured by a lambda. Each expression has its own implementation of this, because each subexpression must be searched.
      Specified by:
      findCaptured in class Expression
      Parameters:
      env - The environment chain to search
    • convertToFullTailCalls

      public Expression convertToFullTailCalls(boolean inTailPosition)
      Description copied from class: Expression
      Converts this expression to one that is compatible with full tail call optimization
      Specified by:
      convertToFullTailCalls in class Expression
      Parameters:
      inTailPosition - True if this expression is called from the tail position
      Returns:
      A version of this expression whose types are compatible with full tail call optimization
    • generate

      public void generate(ClassGenerator generator, Environment env, boolean inTailPosition)
      Description copied from class: Expression
      Generate the bytecode for this expression
      Specified by:
      generate in class Expression
      Parameters:
      generator - The generator for generating instructions and additional declarations
      env - The environment containing the local variables currently visible to this expression
      inTailPosition - True if this expression is being generated from the tail position of the method