Package org.codehaus.groovy.classgen

## Class VariableScopeVisitor

- java.lang.Object
- - org.codehaus.groovy.ast.CodeVisitorSupport
  - - org.codehaus.groovy.ast.ClassCodeVisitorSupport
    - - org.codehaus.groovy.classgen.VariableScopeVisitor

- All Implemented Interfaces:
    `GroovyClassVisitor`, `GroovyCodeVisitor`, `ErrorCollecting`

      public class VariableScopeVisitor
      extends ClassCodeVisitorSupport

  Initializes the variable scopes for an AST.

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `VariableScopeVisitor​(SourceUnit source)` |
    `VariableScopeVisitor​(SourceUnit source, boolean recurseInnerClasses)` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `protected SourceUnit` | `getSourceUnit()` |
    `void` | `prepareVisit​(ClassNode node)` | Sets the current class node context.
    `void` | `visitBinaryExpression​(BinaryExpression expression)` |
    `void` | `visitBlockStatement​(BlockStatement statement)` |
    `void` | `visitCatchStatement​(CatchStatement statement)` |
    `void` | `visitClass​(ClassNode node)` | Visit a ClassNode.
    `void` | `visitClosureExpression​(ClosureExpression expression)` |
    `void` | `visitConstructorCallExpression​(ConstructorCallExpression expression)` |
    `protected void` | `visitConstructorOrMethod​(MethodNode node, boolean isConstructor)` |
    `void` | `visitDeclarationExpression​(DeclarationExpression expression)` |
    `void` | `visitField​(FieldNode node)` | Visit a FieldNode.
    `void` | `visitFieldExpression​(FieldExpression expression)` |
    `void` | `visitForLoop​(ForStatement statement)` |
    `void` | `visitIfElse​(IfStatement statement)` |
    `void` | `visitMethodCallExpression​(MethodCallExpression expression)` |
    `void` | `visitProperty​(PropertyNode node)` | Visit a PropertyNode.
    `void` | `visitPropertyExpression​(PropertyExpression expression)` |
    `void` | `visitVariableExpression​(VariableExpression expression)` |

    - ### Methods inherited from class org.codehaus.groovy.ast.ClassCodeVisitorSupport

      `addError, visitAnnotation, visitAnnotations, visitAssertStatement, visitBreakStatement, visitCaseStatement, visitClassCodeContainer, visitConstructor, visitContinueStatement, visitDoWhileLoop, visitExpressionStatement, visitImports, visitMethod, visitObjectInitializerStatements, visitPackage, visitReturnStatement, visitStatement, visitSwitch, visitSynchronizedStatement, visitThrowStatement, visitTryCatchFinally, visitWhileLoop`

    - ### Methods inherited from class org.codehaus.groovy.ast.CodeVisitorSupport

      `afterSwitchConditionExpressionVisited, visitArgumentlistExpression, visitArrayExpression, visitAttributeExpression, visitBitwiseNegationExpression, visitBooleanExpression, visitBytecodeExpression, visitCastExpression, visitClassExpression, visitClosureListExpression, visitConstantExpression, visitEmptyStatement, visitGStringExpression, visitLambdaExpression, visitListExpression, visitMapEntryExpression, visitMapExpression, visitMethodPointerExpression, visitMethodReferenceExpression, visitNotExpression, visitPostfixExpression, visitPrefixExpression, visitRangeExpression, visitShortTernaryExpression, visitSpreadExpression, visitSpreadMapExpression, visitStaticMethodCallExpression, visitTernaryExpression, visitTupleExpression, visitUnaryMinusExpression, visitUnaryPlusExpression`

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

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

    - ### Methods inherited from interface org.codehaus.groovy.ast.GroovyCodeVisitor

      `visitEmptyExpression, visitListOfExpressions`

- - ### Constructor Detail

    - #### VariableScopeVisitor

          public VariableScopeVisitor​(SourceUnit source,
                                      boolean recurseInnerClasses)

    - #### VariableScopeVisitor

          public VariableScopeVisitor​(SourceUnit source)

  - ### Method Detail

    - #### getSourceUnit

          protected SourceUnit getSourceUnit()

      Specified by:
        `getSourceUnit` in class `ClassCodeVisitorSupport`

    - #### prepareVisit

          public void prepareVisit​(ClassNode node)

      Sets the current class node context.

    - #### visitClass

          public void visitClass​(ClassNode node)

      Description copied from interface: `GroovyClassVisitor`
      Visit a ClassNode.
      Specified by:
        `visitClass` in interface `GroovyClassVisitor`
      Overrides:
        `visitClass` in class `ClassCodeVisitorSupport`

    - #### visitField

          public void visitField​(FieldNode node)

      Description copied from interface: `GroovyClassVisitor`
      Visit a FieldNode.
      Specified by:
        `visitField` in interface `GroovyClassVisitor`
      Overrides:
        `visitField` in class `ClassCodeVisitorSupport`

    - #### visitProperty

          public void visitProperty​(PropertyNode node)

      Description copied from interface: `GroovyClassVisitor`
      Visit a PropertyNode.
      Specified by:
        `visitProperty` in interface `GroovyClassVisitor`
      Overrides:
        `visitProperty` in class `ClassCodeVisitorSupport`

    - #### visitConstructorOrMethod

          protected void visitConstructorOrMethod​(MethodNode node,
                                                  boolean isConstructor)

      Overrides:
        `visitConstructorOrMethod` in class `ClassCodeVisitorSupport`

    - #### visitBlockStatement

          public void visitBlockStatement​(BlockStatement statement)

      Specified by:
        `visitBlockStatement` in interface `GroovyCodeVisitor`
      Overrides:
        `visitBlockStatement` in class `ClassCodeVisitorSupport`

    - #### visitCatchStatement

          public void visitCatchStatement​(CatchStatement statement)

      Specified by:
        `visitCatchStatement` in interface `GroovyCodeVisitor`
      Overrides:
        `visitCatchStatement` in class `ClassCodeVisitorSupport`

    - #### visitForLoop

          public void visitForLoop​(ForStatement statement)

      Specified by:
        `visitForLoop` in interface `GroovyCodeVisitor`
      Overrides:
        `visitForLoop` in class `ClassCodeVisitorSupport`

    - #### visitIfElse

          public void visitIfElse​(IfStatement statement)

      Specified by:
        `visitIfElse` in interface `GroovyCodeVisitor`
      Overrides:
        `visitIfElse` in class `ClassCodeVisitorSupport`

    - #### visitBinaryExpression

          public void visitBinaryExpression​(BinaryExpression expression)

      Specified by:
        `visitBinaryExpression` in interface `GroovyCodeVisitor`
      Overrides:
        `visitBinaryExpression` in class `CodeVisitorSupport`

    - #### visitClosureExpression

          public void visitClosureExpression​(ClosureExpression expression)

      Specified by:
        `visitClosureExpression` in interface `GroovyCodeVisitor`
      Overrides:
        `visitClosureExpression` in class `CodeVisitorSupport`

    - #### visitConstructorCallExpression

          public void visitConstructorCallExpression​(ConstructorCallExpression expression)

      Specified by:
        `visitConstructorCallExpression` in interface `GroovyCodeVisitor`
      Overrides:
        `visitConstructorCallExpression` in class `CodeVisitorSupport`

    - #### visitDeclarationExpression

          public void visitDeclarationExpression​(DeclarationExpression expression)

      Specified by:
        `visitDeclarationExpression` in interface `GroovyCodeVisitor`
      Overrides:
        `visitDeclarationExpression` in class `ClassCodeVisitorSupport`

    - #### visitFieldExpression

          public void visitFieldExpression​(FieldExpression expression)

      Specified by:
        `visitFieldExpression` in interface `GroovyCodeVisitor`
      Overrides:
        `visitFieldExpression` in class `CodeVisitorSupport`

    - #### visitMethodCallExpression

          public void visitMethodCallExpression​(MethodCallExpression expression)

      Specified by:
        `visitMethodCallExpression` in interface `GroovyCodeVisitor`
      Overrides:
        `visitMethodCallExpression` in class `CodeVisitorSupport`

    - #### visitPropertyExpression

          public void visitPropertyExpression​(PropertyExpression expression)

      Specified by:
        `visitPropertyExpression` in interface `GroovyCodeVisitor`
      Overrides:
        `visitPropertyExpression` in class `CodeVisitorSupport`

    - #### visitVariableExpression

          public void visitVariableExpression​(VariableExpression expression)

      Specified by:
        `visitVariableExpression` in interface `GroovyCodeVisitor`
      Overrides:
        `visitVariableExpression` in class `CodeVisitorSupport`