Package org.codehaus.groovy.transform.tailrec

# Class InWhileLoopWrapper

java.lang.Object
org.codehaus.groovy.transform.tailrec.InWhileLoopWrapper

public class InWhileLoopWrapper extends Object
Wrap the body of a method in a while loop, nested in a try-catch. This is the first step in making a tail recursive method iterative.

There are two ways to invoke the next iteration step:

1. "continue _RECUR_HERE_" is used by recursive calls outside of closures
2. "throw LOOP_EXCEPTION" is used by recursive calls within closures b/c you cannot invoke "continue" from there

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final GotoRecurHereException`
  `LOOP_EXCEPTION`
  Exception instance thrown from closures to restart the generated loop.
  `static final String`
  `LOOP_LABEL`
  Label targeted by synthesized `continue` statements.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `InWhileLoopWrapper()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `wrap(MethodNode method)`
  Wraps the supplied method body in the loop structure used by the tail-recursion transform.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### LOOP_LABEL

    public static final String LOOP_LABEL
    Label targeted by synthesized `continue` statements.
    See Also:
      - Constant Field Values

  - ### LOOP_EXCEPTION

    public static final GotoRecurHereException LOOP_EXCEPTION
    Exception instance thrown from closures to restart the generated loop.

- ## Constructor Details

  - ### InWhileLoopWrapper

    public InWhileLoopWrapper()

- ## Method Details

  - ### wrap

    public void wrap(MethodNode method)
    Wraps the supplied method body in the loop structure used by the tail-recursion transform.
    Parameters:
      `method` - the method to rewrite