Class PlaceholderVisitor

All Implemented Interfaces:
GroovyClassVisitor, GroovyCodeVisitor, ErrorCollecting

@Deprecated(since="6.0.1", forRemoval=true) public class PlaceholderVisitor extends ClassCodeVisitorSupport
Deprecated, for removal: This API element is subject to removal in a future version.
since 6.0.1, with no replacement; to recognise a _ variable, check its name.
Marks repeated underscore placeholders used in tuple and closure parameters.

The compiler no longer runs this visitor or reads its mark: a repeated _ is an ordinary variable that may be declared again.

  • Constructor Details

    • PlaceholderVisitor

      public PlaceholderVisitor(CompilationUnit compilationUnit, SourceUnit source)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Creates a visitor for placeholder analysis.
      Parameters:
      compilationUnit - the owning compilation unit
      source - the source unit being visited
  • Method Details

    • getSourceUnit

      protected SourceUnit getSourceUnit()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Returns the source unit currently being visited.
      Specified by:
      getSourceUnit in class ClassCodeVisitorSupport
      Returns:
      the active source unit
    • visitDeclarationExpression

      public void visitDeclarationExpression(DeclarationExpression expression)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Visit the declaration marking underscore-named variables in multi-assignments as placeholders
      Specified by:
      visitDeclarationExpression in interface GroovyCodeVisitor
      Overrides:
      visitDeclarationExpression in class ClassCodeVisitorSupport
      Parameters:
      expression - the expression to check
    • visitClosureExpression

      public void visitClosureExpression(ClosureExpression expression)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Visit the Closure (or Lambda) marking underscore-named parameters as placeholders
      Specified by:
      visitClosureExpression in interface GroovyCodeVisitor
      Overrides:
      visitClosureExpression in class ClassCodeVisitorSupport
      Parameters:
      expression - the expression to check
    • isPlaceholder

      public static boolean isPlaceholder(ASTNode node)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Checks whether the supplied node has been marked as a placeholder.
      Parameters:
      node - the node to inspect
      Returns:
      true if the node is a placeholder