@AutoFinal @CompileStatic class ASTMatcher extends ContextualClassCodeVisitor
Locates all nodes in the given AST which match the pattern AST. This operation can cost a lot, because it tries to match a sub-tree to every node of the AST.
node
- an AST Nodepattern
- a pattern to be found somewhere in the ASTMatches an AST with another AST (pattern). It will return true if the AST matches all the nodes from the pattern AST.
node
- the AST we want to match withpattern
- the pattern AST we want to match toTODO: experimental! Annotates an AST node with matching contraints. This method should be called on an AST intended to be used as a pattern only. It will put node metadata on the AST node allowing customized behavior in pattern matching.
pattern
- a pattern ASTconstraintsSpec
- a closure specification of matching constraints