Class GoogBindToArrow
java.lang.Object
com.google.javascript.refactoring.Scanner
com.google.javascript.refactoring.examples.GoogBindToArrow
- All Implemented Interfaces:
Serializable
Replaces goog.bind(..., this) with arrow functions. The pretty-printer does not do well with
arrow functions, so it is recommended that you run 'g4 fix' to invoke clang-format on the CLs
created by this refactoring.
TODO(tbreisacher): Handle (function(){}).bind(this); as well.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
matches
(Node node, NodeMetadata metadata) Returns true if the given node and node traversal should match for this particular scanner.com.google.common.collect.ImmutableList
<SuggestedFix> processMatch
(Match match) Processes oneMatch
at a time.Methods inherited from class com.google.javascript.refactoring.Scanner
processAllMatches
-
Constructor Details
-
GoogBindToArrow
public GoogBindToArrow()
-
-
Method Details
-
matches
Description copied from class:Scanner
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 toScanner.processMatch(Match)
and all matches will be passed toScanner.processAllMatches(Collection)
at the end of the traversal. -
processMatch
Description copied from class:Scanner
Processes oneMatch
at a time. There is no order guaranteed for when this function will be called with the Match.- Overrides:
processMatch
in classScanner
- Parameters:
match
- TheMatch
from the node and traversal for any match thatScanner.matches(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.
-