Package: org.codehaus.groovy.transform.sc

## [Java] Class TemporaryVariableExpression

- org.codehaus.groovy.transform.sc.TemporaryVariableExpression

-     public class TemporaryVariableExpression
      extends Expression

  A front-end class for ExpressionAsVariableSlot which allows defining temporary variables loaded from variable slots directly at the AST level, without any knowledge of AsmClassGenerator.

  Since:
    2.4.0

- - Inherited fields
    Fields inherited from class | Fields
    --- | ---
    `class Expression` | `EMPTY_ARRAY`

  - ### Constructor Summary

    Constructors
    Constructor and description
    `TemporaryVariableExpression(Expression expression)` Wraps an expression so it can be cached in a temporary variable slot during bytecode generation.

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `public ClassNode` | `getType()` Returns the wrapped expression type.
    `` | `public void` | `remove(WriterController controller)` Releases the temporary variable slot associated with this expression.
    `` | `public Expression` | `transformExpression(ExpressionTransformer transformer)` Transforms the wrapped expression while preserving the shared variable slot.
    `` | `public void` | `visit(GroovyCodeVisitor visitor)` Emits the cached variable-slot access when visiting bytecode, or delegates to the wrapped expression otherwise.

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class Expression` | `getType, setType, transformExpression, transformExpressions, transformExpressions`
    `class AnnotatedNode` | `addAnnotation, addAnnotation, addAnnotations, getAnnotations, getAnnotations, getDeclaringClass, getGroovydoc, getInstance, hasNoRealSourcePosition, isSynthetic, setDeclaringClass, setHasNoRealSourcePosition, setSynthetic`
    `class ASTNode` | `copyNodeMetaData, getColumnNumber, getLastColumnNumber, getLastLineNumber, getLineNumber, getMetaDataMap, getText, setColumnNumber, setLastColumnNumber, setLastLineNumber, setLineNumber, setMetaDataMap, setSourcePosition, visit`

- - ### Constructor Detail

    - #### public TemporaryVariableExpression(Expression expression)

      Wraps an expression so it can be cached in a temporary variable slot during bytecode generation.

      Parameters:
        `expression` - the expression to cache

  - ### Method Detail

    - #### public ClassNode getType()

      Returns the wrapped expression type.

      Returns:
        the inferred type of the wrapped expression

    - #### public void remove(WriterController controller)

      Releases the temporary variable slot associated with this expression.

      Parameters:
        `controller` - the active writer controller

    - #### public Expression transformExpression(ExpressionTransformer transformer)

      Transforms the wrapped expression while preserving the shared variable slot.

      Parameters:
        `transformer` - the expression transformer to apply
      Returns:
        a transformed temporary-variable expression

    - #### public void visit(GroovyCodeVisitor visitor)

      Emits the cached variable-slot access when visiting bytecode, or delegates to the wrapped expression otherwise.

      Parameters:
        `visitor` - the visitor to accept