| Code with Finding: |
class PeepholeSubstituteAlternateSyntax {
/**
* Does the expression contain a property assignment?
*/
private boolean isPropertyAssignmentInExpression(Node n) {
Predicate<Node> isPropertyAssignmentInExpressionPredicate =
new Predicate<Node>() {
@Override
public boolean apply(Node input) {
return (input.getType() == Token.GETPROP &&
input.getParent().getType() == Token.ASSIGN);
}
};
return NodeUtil.has(n, isPropertyAssignmentInExpressionPredicate,
DONT_TRAVERSE_FUNCTIONS_PREDICATE);
}
}
|