Package org.codehaus.groovy.control

# Class LabelVerifier

java.lang.Object
org.codehaus.groovy.ast.CodeVisitorSupport
org.codehaus.groovy.ast.ClassCodeVisitorSupport
org.codehaus.groovy.control.LabelVerifier

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

public class LabelVerifier extends ClassCodeVisitorSupport
This class checks the handling of labels in the AST

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `LabelVerifier(SourceUnit src)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected void`
  `assertNoLabelsMissed()`
  `protected SourceUnit`
  `getSourceUnit()`
  Provides access to the `SourceUnit` for error reporting during visitation.
  `protected void`
  `postVisitStatement(Statement s)`
  `void`
  `visitAssertStatement(AssertStatement statement)`
  Visits an `AssertStatement`, invoking the statement hook before parent traversal.
  `void`
  `visitBlockStatement(BlockStatement statement)`
  Visits a `BlockStatement`, invoking the statement hook before parent traversal.
  `void`
  `visitBreakStatement(BreakStatement breakStatement)`
  Visits a `BreakStatement`, invoking the statement hook before parent traversal.
  `void`
  `visitCaseStatement(CaseStatement statement)`
  Visits a `CaseStatement`, invoking the statement hook before parent traversal.
  `void`
  `visitCatchStatement(CatchStatement statement)`
  Visits a `CatchStatement`, processing variable annotations and invoking the statement hook.
  `protected void`
  `visitClassCodeContainer(Statement code)`
  Visits a code statement container, traversing it if present.
  `void`
  `visitContinueStatement(ContinueStatement continueStatement)`
  Visits a `ContinueStatement`, invoking the statement hook before parent traversal.
  `void`
  `visitDoWhileLoop(DoWhileStatement loop)`
  Visits a `DoWhileStatement`, invoking statement hooks before parent traversal.
  `void`
  `visitEmptyStatement(EmptyStatement statement)`
  Visits an `EmptyStatement`.
  `void`
  `visitExpressionStatement(ExpressionStatement statement)`
  Visits an `ExpressionStatement`, invoking the statement hook before parent traversal.
  `void`
  `visitForLoop(ForStatement loop)`
  Visits a `ForStatement`, invoking statement hooks and processing loop variable annotations.
  `void`
  `visitIfElse(IfStatement cond)`
  Visits an `IfStatement`, invoking the statement hook before parent traversal.
  `void`
  `visitReturnStatement(ReturnStatement statement)`
  Visits a `ReturnStatement`, invoking the statement hook before parent traversal.
  `protected void`
  `visitStatement(Statement s)`
  Hook method called when visiting any `Statement`.
  `void`
  `visitSwitch(SwitchStatement switchStatement)`
  Visits a `SwitchStatement`, invoking the statement hook before parent traversal.
  `void`
  `visitSynchronizedStatement(SynchronizedStatement statement)`
  Visits a `SynchronizedStatement`, invoking the statement hook before parent traversal.
  `void`
  `visitThrowStatement(ThrowStatement statement)`
  Visits a `ThrowStatement`, invoking the statement hook before parent traversal.
  `void`
  `visitTryCatchFinally(TryCatchStatement statement)`
  Visits a `TryCatchStatement`, invoking the statement hook before parent traversal.
  `void`
  `visitWhileLoop(WhileStatement loop)`
  Visits a `WhileStatement`, invoking statement hooks before parent traversal.

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

  `addError, visitAnnotation, visitAnnotations, visitAnnotations, visitClass, visitClosureExpression, visitConstructor, visitConstructorOrMethod, visitDeclarationExpression, visitField, visitImports, visitMethod, visitObjectInitializerStatements, visitPackage, visitProperty, visitStatementAnnotations`

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

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

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

  - ### LabelVerifier

    public LabelVerifier(SourceUnit src)

- ## Method Details

  - ### getSourceUnit

    protected SourceUnit getSourceUnit()
    Description copied from class: `ClassCodeVisitorSupport`
    Provides access to the `SourceUnit` for error reporting during visitation. Implementations must override this method.
    Specified by:
      `getSourceUnit` in class `ClassCodeVisitorSupport`
    Returns:
      the source unit for this visitor

  - ### assertNoLabelsMissed

    protected void assertNoLabelsMissed()

  - ### visitStatement

    protected void visitStatement(Statement s)
    Description copied from class: `ClassCodeVisitorSupport`
    Hook method called when visiting any `Statement`. Subclasses may override to perform common processing on all statements.
    Parameters:
      `s` - the statement being visited

  - ### postVisitStatement

    protected void postVisitStatement(Statement s)

  - ### visitClassCodeContainer

    protected void visitClassCodeContainer(Statement code)
    Description copied from class: `ClassCodeVisitorSupport`
    Visits a code statement container, traversing it if present.
    Overrides:
      `visitClassCodeContainer` in class `ClassCodeVisitorSupport`
    Parameters:
      `code` - the statement to visit, may be null

  - ### visitIfElse

    public void visitIfElse(IfStatement cond)
    Description copied from class: `ClassCodeVisitorSupport`
    Visits an `IfStatement`, invoking the statement hook before parent traversal.
    Specified by:
      `visitIfElse` in interface `GroovyCodeVisitor`
    Parameters:
      `cond` - the if statement to visit

  - ### visitForLoop

    public void visitForLoop(ForStatement loop)
    Description copied from class: `ClassCodeVisitorSupport`
    Visits a `ForStatement`, invoking statement hooks and processing loop variable annotations.
    Specified by:
      `visitForLoop` in interface `GroovyCodeVisitor`
    Parameters:
      `loop` - the for statement to visit

  - ### visitWhileLoop

    public void visitWhileLoop(WhileStatement loop)
    Description copied from class: `ClassCodeVisitorSupport`
    Visits a `WhileStatement`, invoking statement hooks before parent traversal.
    Specified by:
      `visitWhileLoop` in interface `GroovyCodeVisitor`
    Parameters:
      `loop` - the while statement to visit

  - ### visitDoWhileLoop

    public void visitDoWhileLoop(DoWhileStatement loop)
    Description copied from class: `ClassCodeVisitorSupport`
    Visits a `DoWhileStatement`, invoking statement hooks before parent traversal.
    Specified by:
      `visitDoWhileLoop` in interface `GroovyCodeVisitor`
    Parameters:
      `loop` - the do-while statement to visit

  - ### visitSwitch

    public void visitSwitch(SwitchStatement switchStatement)
    Description copied from class: `ClassCodeVisitorSupport`
    Visits a `SwitchStatement`, invoking the statement hook before parent traversal.
    Specified by:
      `visitSwitch` in interface `GroovyCodeVisitor`
    Parameters:
      `switchStatement` - the switch statement to visit

  - ### visitBreakStatement

    public void visitBreakStatement(BreakStatement breakStatement)
    Description copied from class: `ClassCodeVisitorSupport`
    Visits a `BreakStatement`, invoking the statement hook before parent traversal.
    Specified by:
      `visitBreakStatement` in interface `GroovyCodeVisitor`
    Parameters:
      `breakStatement` - the break statement to visit

  - ### visitContinueStatement

    public void visitContinueStatement(ContinueStatement continueStatement)
    Description copied from class: `ClassCodeVisitorSupport`
    Visits a `ContinueStatement`, invoking the statement hook before parent traversal.
    Specified by:
      `visitContinueStatement` in interface `GroovyCodeVisitor`
    Parameters:
      `continueStatement` - the continue statement to visit

  - ### visitAssertStatement

    public void visitAssertStatement(AssertStatement statement)
    Description copied from class: `ClassCodeVisitorSupport`
    Visits an `AssertStatement`, invoking the statement hook before parent traversal.
    Specified by:
      `visitAssertStatement` in interface `GroovyCodeVisitor`
    Overrides:
      `visitAssertStatement` in class `ClassCodeVisitorSupport`
    Parameters:
      `statement` - the assert statement to visit

  - ### visitBlockStatement

    public void visitBlockStatement(BlockStatement statement)
    Description copied from class: `ClassCodeVisitorSupport`
    Visits a `BlockStatement`, invoking the statement hook before parent traversal.
    Specified by:
      `visitBlockStatement` in interface `GroovyCodeVisitor`
    Overrides:
      `visitBlockStatement` in class `ClassCodeVisitorSupport`
    Parameters:
      `statement` - the block statement to visit
    See Also:
      - `CodeVisitorSupport.visitForLoop(ForStatement)`
      - `CodeVisitorSupport.visitWhileLoop(WhileStatement)`

  - ### visitCaseStatement

    public void visitCaseStatement(CaseStatement statement)
    Description copied from class: `ClassCodeVisitorSupport`
    Visits a `CaseStatement`, invoking the statement hook before parent traversal.
    Specified by:
      `visitCaseStatement` in interface `GroovyCodeVisitor`
    Overrides:
      `visitCaseStatement` in class `ClassCodeVisitorSupport`
    Parameters:
      `statement` - the case statement to visit

  - ### visitCatchStatement

    public void visitCatchStatement(CatchStatement statement)
    Description copied from class: `ClassCodeVisitorSupport`
    Visits a `CatchStatement`, processing variable annotations and invoking the statement hook.
    Specified by:
      `visitCatchStatement` in interface `GroovyCodeVisitor`
    Overrides:
      `visitCatchStatement` in class `ClassCodeVisitorSupport`
    Parameters:
      `statement` - the catch statement to visit

  - ### visitEmptyStatement

    public void visitEmptyStatement(EmptyStatement statement)
    Description copied from class: `CodeVisitorSupport`
    Visits an `EmptyStatement`. No traversal is performed as empty statements contain no child nodes.
    Specified by:
      `visitEmptyStatement` in interface `GroovyCodeVisitor`
    Overrides:
      `visitEmptyStatement` in class `CodeVisitorSupport`
    Parameters:
      `statement` - the empty statement

  - ### visitExpressionStatement

    public void visitExpressionStatement(ExpressionStatement statement)
    Description copied from class: `ClassCodeVisitorSupport`
    Visits an `ExpressionStatement`, invoking the statement hook before parent traversal.
    Specified by:
      `visitExpressionStatement` in interface `GroovyCodeVisitor`
    Overrides:
      `visitExpressionStatement` in class `ClassCodeVisitorSupport`
    Parameters:
      `statement` - the expression statement to visit

  - ### visitReturnStatement

    public void visitReturnStatement(ReturnStatement statement)
    Description copied from class: `ClassCodeVisitorSupport`
    Visits a `ReturnStatement`, invoking the statement hook before parent traversal.
    Specified by:
      `visitReturnStatement` in interface `GroovyCodeVisitor`
    Overrides:
      `visitReturnStatement` in class `ClassCodeVisitorSupport`
    Parameters:
      `statement` - the return statement to visit

  - ### visitSynchronizedStatement

    public void visitSynchronizedStatement(SynchronizedStatement statement)
    Description copied from class: `ClassCodeVisitorSupport`
    Visits a `SynchronizedStatement`, invoking the statement hook before parent traversal.
    Specified by:
      `visitSynchronizedStatement` in interface `GroovyCodeVisitor`
    Overrides:
      `visitSynchronizedStatement` in class `ClassCodeVisitorSupport`
    Parameters:
      `statement` - the synchronized statement to visit

  - ### visitThrowStatement

    public void visitThrowStatement(ThrowStatement statement)
    Description copied from class: `ClassCodeVisitorSupport`
    Visits a `ThrowStatement`, invoking the statement hook before parent traversal.
    Specified by:
      `visitThrowStatement` in interface `GroovyCodeVisitor`
    Overrides:
      `visitThrowStatement` in class `ClassCodeVisitorSupport`
    Parameters:
      `statement` - the throw statement to visit

  - ### visitTryCatchFinally

    public void visitTryCatchFinally(TryCatchStatement statement)
    Description copied from class: `ClassCodeVisitorSupport`
    Visits a `TryCatchStatement`, invoking the statement hook before parent traversal.
    Specified by:
      `visitTryCatchFinally` in interface `GroovyCodeVisitor`
    Overrides:
      `visitTryCatchFinally` in class `ClassCodeVisitorSupport`
    Parameters:
      `statement` - the try-catch statement to visit