Package io.codemodder.ast
Class LocalScope
java.lang.Object
io.codemodder.ast.LocalScope
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 TypeMethodDescriptionstatic LocalScope
fromAssignExpression
(com.github.javaparser.ast.expr.AssignExpr aexpr) Calculates the scope of a AssignmentAssignExpr
.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 aForStmt
.static LocalScope
fromForEachDeclaration
(com.github.javaparser.ast.stmt.ForEachStmt stmt) Calculates the scope of a local declaration in aForEachStmt
.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 aExpressionStmt
.static LocalScope
fromParameter
(com.github.javaparser.ast.body.Parameter parameter) Calculates the scope of a local declaration in aParameter
.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 aTryStmt
.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 ifn
is contained inscope
Stream<com.github.javaparser.ast.Node>
stream()
-
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 aTryStmt
. -
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 aExpressionStmt
. -
fromForEachDeclaration
Calculates the scope of a local declaration in aForEachStmt
. -
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 aForStmt
. -
fromParameter
Calculates the scope of a local declaration in aParameter
. -
fromAssignExpression
Calculates the scope of a AssignmentAssignExpr
. This function is currently incomplete as it only works if the AssignExpr is contained in an ExpressionStmt. -
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
-
inScope
public boolean inScope(com.github.javaparser.ast.Node n) Returns true if and only ifn
is contained inscope
-