ReturnStatementToIterationConverter (Groovy 5.0.7)
Description: declaration: package: org.codehaus.groovy.transform.tailrec, class: ReturnStatementToIterationConverter

Package org.codehaus.groovy.transform.tailrec

# Class ReturnStatementToIterationConverter

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

public class ReturnStatementToIterationConverter extends Object
Translates all return statements into an invocation of the next iteration. This can be either - "continue LOOP_LABEL": Outside closures - "throw LOOP_EXCEPTION": Inside closures

Moreover, before adding the recur statement the iteration parameters (originally the method args) are set to their new value. To prevent variable aliasing parameters will be copied into temp vars before they are changes so that their current iteration value can be used when setting other params.

There's probably place for optimizing the amount of variable copying being done, e.g. parameters that are only handed through must not be copied at all.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ReturnStatementToIterationConverter()`
  `ReturnStatementToIterationConverter(Statement recurStatement)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Statement`
  `convert(ReturnStatement statement, Map<Integer,Map<String,Object>> positionMapping)`
  `Statement`
  `getRecurStatement()`
  `void`
  `setRecurStatement(Statement recurStatement)`

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

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

- ## Constructor Details

  - ### ReturnStatementToIterationConverter

    public ReturnStatementToIterationConverter()

  - ### ReturnStatementToIterationConverter

    public ReturnStatementToIterationConverter(Statement recurStatement)

- ## Method Details

  - ### convert

    public Statement convert(ReturnStatement statement, Map<Integer,Map<String,Object>> positionMapping)

  - ### getRecurStatement

    public Statement getRecurStatement()

  - ### setRecurStatement

    public void setRecurStatement(Statement recurStatement)