SSR: cleanup

This commit is contained in:
Bas Leijdekkers
2019-04-16 17:45:09 +02:00
parent 3886cec4a3
commit 6e7aeea50b
2 changed files with 7 additions and 7 deletions
@@ -1,4 +1,4 @@
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.structuralsearch.impl.matcher;
import com.intellij.dupLocator.AbstractMatchingVisitor;
@@ -173,11 +173,11 @@ public class GlobalMatchingVisitor extends AbstractMatchingVisitor {
*/
@Override
public boolean matchSequentially(NodeIterator patternNodes, NodeIterator matchNodes) {
final PsiElement current = patternNodes.current();
if (!patternNodes.hasNext()) {
while (matchNodes.current() instanceof PsiComment) matchNodes.advance();
return !matchNodes.hasNext();
}
final PsiElement current = patternNodes.current();
return matchContext.getPattern().getHandler(current).matchSequentially(patternNodes, matchNodes, matchContext);
}
@@ -1,4 +1,4 @@
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.structuralsearch.impl.matcher.handlers;
import com.intellij.dupLocator.iterators.NodeIterator;
@@ -83,12 +83,12 @@ public abstract class MatchingHandler {
}
private static void skipComments(NodeIterator matchNodes, PsiElement patternNode) {
final boolean skipComment = !(patternNode instanceof PsiComment);
while (skipComment && matchNodes.current() instanceof PsiComment) matchNodes.advance();
if (patternNode instanceof PsiComment) return;
while (matchNodes.current() instanceof PsiComment) matchNodes.advance();
}
private static void skipIfNecessary(NodeIterator nodes, PsiElement elementToMatchWith, MatchingStrategy strategy) {
while (strategy.shouldSkip(nodes.current(), elementToMatchWith)) {
while (nodes.hasNext() && strategy.shouldSkip(nodes.current(), elementToMatchWith)) {
nodes.advance();
}
}
@@ -201,7 +201,7 @@ public abstract class MatchingHandler {
}
protected static boolean validateSatisfactionOfHandlers(NodeIterator patternNodes, MatchContext context) {
for (;patternNodes.hasNext(); patternNodes.advance()) {
for (; patternNodes.hasNext(); patternNodes.advance()) {
if (!context.getPattern().getHandler(patternNodes.current()).validate(context, 0)) {
return false;
}