Class Scanner
java.lang.Object
com.google.javascript.refactoring.Scanner
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
GoogBindToArrow
Class that developers should implement to perform a JsFlume refactoring.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract boolean
matches
(Node node, NodeMetadata t) Returns true if the given node and node traversal should match for this particular scanner.processAllMatches
(Collection<Match> matches) Processes every given match at one time.processMatch
(Match match) Processes oneMatch
at a time.
-
Constructor Details
-
Scanner
public Scanner()
-
-
Method Details
-
matches
Returns true if the given node and node traversal should match for this particular scanner. Typically this function uses theMatcher
class or predefined matchers fromMatchers
to match against the Node and NodeMetadata. If this function returns true, aMatch
for this node will be passed toprocessMatch(Match)
and all matches will be passed toprocessAllMatches(Collection)
at the end of the traversal. -
processMatch
Processes oneMatch
at a time. There is no order guaranteed for when this function will be called with the Match.- Parameters:
match
- TheMatch
from the node and traversal for any match thatmatches(com.google.javascript.rhino.Node, com.google.javascript.refactoring.NodeMetadata)
returned true for.- Returns:
- List of
SuggestedFix
classes that will be applied to the source files at the end of the run to create the refactoring CL.
-
processAllMatches
Processes every given match at one time. This function can be used when the refactoring needs the information from the entire run to perform the refactoring, such as moving functions around.- Parameters:
matches
- All theMatch
matches that were collected when thematches(com.google.javascript.rhino.Node, com.google.javascript.refactoring.NodeMetadata)
function returned true.- Returns:
- List of
SuggestedFix
classes that will be applied to the source files at the end of the run to create the refactoring CL.
-