MCPcopy
hub / github.com/google/closure-compiler / Scanner

Class Scanner

src/com/google/javascript/refactoring/Scanner.java:29–67  ·  view source on GitHub ↗

Class that developers should implement to perform a JsFlume refactoring.

Source from the content-addressed store, hash-verified

27 * Class that developers should implement to perform a JsFlume refactoring.
28 */
29public abstract class Scanner implements Serializable {
30
31 /**
32 * Returns true if the given node and node traversal should match for this
33 * particular scanner. Typically this function uses the {@link Matcher} class
34 * or predefined matchers from {@link Matchers} to match against the Node and
35 * NodeMetadata.
36 *
37 * If this function returns true, a {@link Match} for this node will be passed
38 * to {@link #processMatch(Match)} and all matches will be passed to
39 * {@link #processAllMatches(Collection)} at the end of the traversal.
40 */
41 public abstract boolean matches(Node node, NodeMetadata t);
42
43 /**
44 * Processes one {@link Match} at a time. There is no order guaranteed for
45 * when this function will be called with the Match.
46 * @param match The {@link Match} from the node and traversal for any match
47 * that {@link #matches} returned true for.
48 * @return List of {@link SuggestedFix} classes that will be applied to the
49 * source files at the end of the run to create the refactoring CL.
50 */
51 public List<SuggestedFix> processMatch(Match match) {
52 return ImmutableList.of();
53 }
54
55 /**
56 * Processes every given match at one time. This function can be used when
57 * the refactoring needs the information from the entire run to perform the
58 * refactoring, such as moving functions around.
59 * @param matches All the {@link Match} matches that were collected when the
60 * {@link #matches} function returned true.
61 * @return List of {@link SuggestedFix} classes that will be applied to the
62 * source files at the end of the run to create the refactoring CL.
63 */
64 public List<SuggestedFix> processAllMatches(Collection<Match> matches) {
65 return ImmutableList.of();
66 }
67}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected