Class LocalScope

java.lang.Object
io.codemodder.ast.LocalScope

public final class LocalScope extends Object
Contains the expressions and statements that span the scope of a local declaration. See Java Language Specification - Section 6.3 for how the scope of local declarations is defined. The nodelists are ordered and the nodes in expressions happens before the ones in statements.
  • Method Summary

    Modifier and Type
    Method
    Description
    static LocalScope
    fromForDeclaration(com.github.javaparser.ast.stmt.ForStmt stmt, com.github.javaparser.ast.body.VariableDeclarator vd)
    Calculates the scope of a local declaration in a ForStmt.
    static LocalScope
    fromForEachDeclaration(com.github.javaparser.ast.stmt.ForEachStmt stmt)
    Calculates the scope of a local declaration in a ForEachStmt.
    static LocalScope
    fromLocalDeclaration(com.github.javaparser.ast.stmt.ExpressionStmt stmt, com.github.javaparser.ast.body.VariableDeclarator vd)
    Calculates the scope of a local declaration in a ExpressionStmt.
    static LocalScope
    fromParameter(com.github.javaparser.ast.body.Parameter parameter)
    Calculates the scope of a local declaration in a Parameter.
    static LocalScope
    fromTryResource(com.github.javaparser.ast.stmt.TryStmt stmt, com.github.javaparser.ast.body.VariableDeclarator vd)
    Calculates the scope of a local declaration in a TryStmt.
    com.github.javaparser.ast.NodeList<com.github.javaparser.ast.expr.Expression>
     
    com.github.javaparser.ast.NodeList<com.github.javaparser.ast.stmt.Statement>
     
    boolean
    inScope(com.github.javaparser.ast.Node n)
    Returns true if and only if n is contained in scope
    Stream<com.github.javaparser.ast.Node>
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • fromTryResource

      public static LocalScope fromTryResource(com.github.javaparser.ast.stmt.TryStmt stmt, com.github.javaparser.ast.body.VariableDeclarator vd)
      Calculates the scope of a local declaration in a TryStmt.
    • fromLocalDeclaration

      public static LocalScope fromLocalDeclaration(com.github.javaparser.ast.stmt.ExpressionStmt stmt, com.github.javaparser.ast.body.VariableDeclarator vd)
      Calculates the scope of a local declaration in a ExpressionStmt.
    • fromForEachDeclaration

      public static LocalScope fromForEachDeclaration(com.github.javaparser.ast.stmt.ForEachStmt stmt)
      Calculates the scope of a local declaration in a ForEachStmt.
    • fromForDeclaration

      public static LocalScope fromForDeclaration(com.github.javaparser.ast.stmt.ForStmt stmt, com.github.javaparser.ast.body.VariableDeclarator vd)
      Calculates the scope of a local declaration in a ForStmt.
    • fromParameter

      public static LocalScope fromParameter(com.github.javaparser.ast.body.Parameter parameter)
      Calculates the scope of a local declaration in a Parameter.
    • getExpressions

      public com.github.javaparser.ast.NodeList<com.github.javaparser.ast.expr.Expression> getExpressions()
    • getStatements

      public com.github.javaparser.ast.NodeList<com.github.javaparser.ast.stmt.Statement> getStatements()
    • stream

      public Stream<com.github.javaparser.ast.Node> stream()
    • inScope

      public boolean inScope(com.github.javaparser.ast.Node n)
      Returns true if and only if n is contained in scope