Package org.sonar.python.tree
Class TreeUtils
- java.lang.Object
-
- org.sonar.python.tree.TreeUtils
-
public class TreeUtils extends Object
-
-
Method Summary
-
-
-
Method Detail
-
firstAncestor
@CheckForNull public static Tree firstAncestor(Tree tree, Predicate<Tree> predicate)
-
firstAncestorOfKind
@CheckForNull public static Tree firstAncestorOfKind(Tree tree, Tree.Kind... kinds)
-
flattenTuples
public static Stream<Expression> flattenTuples(Expression expression)
-
getClassSymbolFromDef
@CheckForNull public static ClassSymbol getClassSymbolFromDef(@Nullable ClassDef classDef)
-
getFunctionSymbolFromDef
@CheckForNull public static FunctionSymbol getFunctionSymbolFromDef(@Nullable FunctionDef functionDef)
-
nonTupleParameters
public static List<Parameter> nonTupleParameters(FunctionDef functionDef)
-
positionalParameters
public static List<Parameter> positionalParameters(FunctionDef functionDef)
-
topLevelFunctionDefs
public static List<FunctionDef> topLevelFunctionDefs(ClassDef classDef)
Collects all top-level function definitions within a class def. It is used to discover methods defined within "strange" constructs, such asclass A: if p: def f(self): ...
-
nthArgumentOrKeyword
@CheckForNull public static RegularArgument nthArgumentOrKeyword(int argPosition, String keyword, List<Argument> arguments)
-
isBooleanLiteral
public static boolean isBooleanLiteral(Tree tree)
-
locationInFile
@CheckForNull public static LocationInFile locationInFile(Tree tree, @Nullable String fileId)
-
-