Package de.fraunhofer.aisec.cpg.helpers
Class SubgraphWalker.ScopedWalker
- java.lang.Object
-
- de.fraunhofer.aisec.cpg.helpers.SubgraphWalker.ScopedWalker
-
- Enclosing class:
- SubgraphWalker
public static class SubgraphWalker.ScopedWalker extends java.lang.ObjectHandles declaration scope monitoring for iterative traversals. If this is not required, useSubgraphWalker.IterativeGraphWalkerfor less overhead.Declaration scopes are similar to
ScopeManagerscopes:ValueDeclarations located inside a scope (i.e. are children of the scope root) are visible to any children of the scope root. Scopes can be layered, where declarations from parent scopes are visible to the children but not the other way around.
-
-
Constructor Summary
Constructors Constructor Description ScopedWalker(LanguageFrontend lang)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclearCallbacks()voidcollectDeclarations(Node current)java.util.List<ValueDeclaration>getAllDeclarationsForScope(Node scope)@Nullable RecordDeclarationgetCurrentClass()java.util.Optional<? extends ValueDeclaration>getDeclarationForScope(Node scope, java.util.function.Predicate<ValueDeclaration> predicate)voiditerate(Node root)WrapsSubgraphWalker.IterativeGraphWalkerto handle declaration scopes.voidregisterHandler(TriConsumer<RecordDeclaration,Node,Node> handler)voidregisterHandler(java.util.function.BiConsumer<Node,RecordDeclaration> handler)
-
-
-
Constructor Detail
-
ScopedWalker
public ScopedWalker(LanguageFrontend lang)
-
-
Method Detail
-
clearCallbacks
public void clearCallbacks()
-
registerHandler
public void registerHandler(TriConsumer<RecordDeclaration,Node,Node> handler)
-
registerHandler
public void registerHandler(java.util.function.BiConsumer<Node,RecordDeclaration> handler)
-
iterate
public void iterate(Node root)
WrapsSubgraphWalker.IterativeGraphWalkerto handle declaration scopes.- Parameters:
root- The node where AST descent is started
-
getCurrentClass
public @Nullable RecordDeclaration getCurrentClass()
-
collectDeclarations
public void collectDeclarations(Node current)
-
getAllDeclarationsForScope
public java.util.List<ValueDeclaration> getAllDeclarationsForScope(Node scope)
-
getDeclarationForScope
public java.util.Optional<? extends ValueDeclaration> getDeclarationForScope(Node scope, java.util.function.Predicate<ValueDeclaration> predicate)
-
-