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

  goes through an AST and initializes the scopes

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `VariableScopeVisitor(SourceUnit source)`
    `VariableScopeVisitor(SourceUnit source, boolean recurseInnerClasses)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected SourceUnit` | `getSourceUnit()`
    `void` | `prepareVisit(ClassNode node)` Setup the current class node context.
    `void` | `visitAnnotations(AnnotatedNode node)`
    `void` | `visitBinaryExpression(BinaryExpression be)`
    `void` | `visitBlockStatement(BlockStatement block)`
    `void` | `visitCatchStatement(CatchStatement statement)`
    `void` | `visitClass(ClassNode node)` Visit a ClassNode.
    `void` | `visitClosureExpression(ClosureExpression expression)`
    `void` | `visitConstructorCallExpression(ConstructorCallExpression call)`
    `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 forLoop)`
    `void` | `visitIfElse(IfStatement ifElse)`
    `void` | `visitMethodCallExpression(MethodCallExpression call)`
    `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, 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

      `visitArgumentlistExpression, visitArrayExpression, visitAttributeExpression, visitBitwiseNegationExpression, visitBooleanExpression, visitBytecodeExpression, visitCastExpression, visitClassExpression, visitClosureListExpression, visitConstantExpression, visitEmptyStatement, visitGStringExpression, visitListExpression, visitListOfExpressions, visitMapEntryExpression, visitMapExpression, visitMethodPointerExpression, 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`

- - ### 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`

    - #### visitBlockStatement

          public void visitBlockStatement(BlockStatement block)

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

    - #### visitForLoop

          public void visitForLoop(ForStatement forLoop)

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

    - #### visitIfElse

          public void visitIfElse(IfStatement ifElse)

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

    - #### visitDeclarationExpression

          public void visitDeclarationExpression(DeclarationExpression expression)

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

    - #### visitBinaryExpression

          public void visitBinaryExpression(BinaryExpression be)

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

    - #### visitVariableExpression

          public void visitVariableExpression(VariableExpression expression)

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

    - #### visitPropertyExpression

          public void visitPropertyExpression(PropertyExpression expression)

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

    - #### visitClosureExpression

          public void visitClosureExpression(ClosureExpression expression)

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

    - #### visitCatchStatement

          public void visitCatchStatement(CatchStatement statement)

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

    - #### visitFieldExpression

          public void visitFieldExpression(FieldExpression expression)

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

    - #### 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`

    - #### prepareVisit

          public void prepareVisit(ClassNode node)

      Setup the current class node context.
      Parameters:
        `node` -

    - #### visitConstructorOrMethod

          protected void visitConstructorOrMethod(MethodNode node,
                                                  boolean isConstructor)

      Overrides:
        `visitConstructorOrMethod` in class `ClassCodeVisitorSupport`

    - #### visitMethodCallExpression

          public void visitMethodCallExpression(MethodCallExpression call)

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

    - #### visitConstructorCallExpression

          public void visitConstructorCallExpression(ConstructorCallExpression call)

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

    - #### 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`

    - #### 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`

    - #### visitAnnotations

          public void visitAnnotations(AnnotatedNode node)

      Overrides:
        `visitAnnotations` in class `ClassCodeVisitorSupport`