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

  Modifier and Type
  Method
  Description
  `protected SourceUnit`
  `getSourceUnit()`
  `void`
  `prepareVisit(ClassNode node)`
  Sets the current class node context.
  `protected void`
  `visitAnnotation(AnnotationNode node)`
  `void`
  `visitArrayExpression(ArrayExpression expression)`
  `void`
  `visitAssertStatement(AssertStatement statement)`
  `void`
  `visitBinaryExpression(BinaryExpression expression)`
  `void`
  `visitBlockStatement(BlockStatement statement)`
  `void`
  `visitCastExpression(CastExpression expression)`
  `void`
  `visitCatchStatement(CatchStatement statement)`
  `void`
  `visitClass(ClassNode node)`
  Visit a ClassNode.
  `void`
  `visitClassExpression(ClassExpression expression)`
  `void`
  `visitClosureExpression(ClosureExpression expression)`
  `void`
  `visitConstantExpression(ConstantExpression expression)`
  `void`
  `visitConstructorCallExpression(ConstructorCallExpression expression)`
  `protected void`
  `visitConstructorOrMethod(MethodNode node, boolean isConstructor)`
  `void`
  `visitDeclarationExpression(DeclarationExpression expression)`
  `void`
  `visitDoWhileLoop(DoWhileStatement statement)`
  `void`
  `visitExpressionStatement(ExpressionStatement statement)`
  `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`
  `visitReturnStatement(ReturnStatement statement)`
  `void`
  `visitSwitch(SwitchStatement statement)`
  `void`
  `visitVariableExpression(VariableExpression expression)`
  `void`
  `visitWhileLoop(WhileStatement statement)`

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

  `addError, visitAnnotations, visitAnnotations, visitBreakStatement, visitCaseStatement, visitClassCodeContainer, visitConstructor, visitContinueStatement, visitImports, visitMethod, visitObjectInitializerStatements, visitPackage, visitStatement, visitSynchronizedStatement, visitThrowStatement, visitTryCatchFinally`

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

  `afterSwitchCaseStatementsVisited, afterSwitchConditionExpressionVisited, visitArgumentlistExpression, visitAttributeExpression, visitBitwiseNegationExpression, visitBooleanExpression, visitBytecodeExpression, visitClosureListExpression, 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

  `visit, visit, visitEmptyExpression, visitListOfExpressions`

- ## Constructor Details

  - ### VariableScopeVisitor

    public VariableScopeVisitor(SourceUnit source, boolean recurseInnerClasses)

  - ### VariableScopeVisitor

    public VariableScopeVisitor(SourceUnit source)

- ## Method Details

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

  - ### visitAnnotation

    protected void visitAnnotation(AnnotationNode node)
    Overrides:
      `visitAnnotation` in class `ClassCodeVisitorSupport`

  - ### visitConstructorOrMethod

    protected void visitConstructorOrMethod(MethodNode node, boolean isConstructor)
    Overrides:
      `visitConstructorOrMethod` in class `ClassCodeVisitorSupport`

  - ### visitAssertStatement

    public void visitAssertStatement(AssertStatement statement)
    Specified by:
      `visitAssertStatement` in interface `GroovyCodeVisitor`
    Overrides:
      `visitAssertStatement` 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`

  - ### visitDoWhileLoop

    public void visitDoWhileLoop(DoWhileStatement statement)
    Specified by:
      `visitDoWhileLoop` in interface `GroovyCodeVisitor`
    Overrides:
      `visitDoWhileLoop` in class `ClassCodeVisitorSupport`

  - ### visitExpressionStatement

    public void visitExpressionStatement(ExpressionStatement statement)
    Specified by:
      `visitExpressionStatement` in interface `GroovyCodeVisitor`
    Overrides:
      `visitExpressionStatement` 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`

  - ### visitReturnStatement

    public void visitReturnStatement(ReturnStatement statement)
    Specified by:
      `visitReturnStatement` in interface `GroovyCodeVisitor`
    Overrides:
      `visitReturnStatement` in class `ClassCodeVisitorSupport`

  - ### visitSwitch

    public void visitSwitch(SwitchStatement statement)
    Specified by:
      `visitSwitch` in interface `GroovyCodeVisitor`
    Overrides:
      `visitSwitch` in class `ClassCodeVisitorSupport`

  - ### visitWhileLoop

    public void visitWhileLoop(WhileStatement statement)
    Specified by:
      `visitWhileLoop` in interface `GroovyCodeVisitor`
    Overrides:
      `visitWhileLoop` in class `ClassCodeVisitorSupport`

  - ### visitArrayExpression

    public void visitArrayExpression(ArrayExpression expression)
    Specified by:
      `visitArrayExpression` in interface `GroovyCodeVisitor`
    Overrides:
      `visitArrayExpression` in class `CodeVisitorSupport`

  - ### visitBinaryExpression

    public void visitBinaryExpression(BinaryExpression expression)
    Specified by:
      `visitBinaryExpression` in interface `GroovyCodeVisitor`
    Overrides:
      `visitBinaryExpression` in class `CodeVisitorSupport`

  - ### visitCastExpression

    public void visitCastExpression(CastExpression expression)
    Specified by:
      `visitCastExpression` in interface `GroovyCodeVisitor`
    Overrides:
      `visitCastExpression` in class `CodeVisitorSupport`

  - ### visitClassExpression

    public void visitClassExpression(ClassExpression expression)
    Specified by:
      `visitClassExpression` in interface `GroovyCodeVisitor`
    Overrides:
      `visitClassExpression` in class `CodeVisitorSupport`

  - ### visitClosureExpression

    public void visitClosureExpression(ClosureExpression expression)
    Specified by:
      `visitClosureExpression` in interface `GroovyCodeVisitor`
    Overrides:
      `visitClosureExpression` in class `ClassCodeVisitorSupport`

  - ### visitConstantExpression

    public void visitConstantExpression(ConstantExpression expression)
    Specified by:
      `visitConstantExpression` in interface `GroovyCodeVisitor`
    Overrides:
      `visitConstantExpression` 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`