Class JsSourceMatcher
java.lang.Object
com.google.javascript.refactoring.JsSourceMatcher
- All Implemented Interfaces:
Matcher
A
Matcher that can take arbitrary JS source code and use it as a
template to find matches in other source code.-
Constructor Summary
ConstructorsConstructorDescriptionJsSourceMatcher(AbstractCompiler compiler, Node templateNode, TypeMatchingStrategy typeMatchingStrategy) Constructs this matcher with a Function node that serves as the template to match all other nodes against. -
Method Summary
Modifier and TypeMethodDescriptionReturns a map from named template node strings to Nodes that were the equivalent matches from the last matched template.booleanmatches(Node n, NodeMetadata metadata) Returns true if the specifiedNodeandNodeMetadatamatch the given pattern.
-
Constructor Details
-
JsSourceMatcher
public JsSourceMatcher(AbstractCompiler compiler, Node templateNode, TypeMatchingStrategy typeMatchingStrategy) Constructs this matcher with a Function node that serves as the template to match all other nodes against. The body of the function will be used to match against.
-
-
Method Details
-
matches
Description copied from interface:MatcherReturns true if the specifiedNodeandNodeMetadatamatch the given pattern. -
getTemplateNodeToMatchMap
Returns a map from named template node strings to Nodes that were the equivalent matches from the last matched template.
-