mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
SSR: remove unnecessary methods from matching handlers
This commit is contained in:
+1
-7
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -42,12 +42,6 @@ public final class LightTopLevelMatchingHandler extends MatchingHandler implemen
|
||||
return myDelegate.matchSequentially(nodes, nodes2, context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean match(final PsiElement patternNode,
|
||||
final PsiElement matchedNode, final int start, final int end, final MatchContext context) {
|
||||
return myDelegate.match(patternNode, matchedNode, start, end, context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMatchSequentiallySucceeded(final NodeIterator nodes2) {
|
||||
return true;
|
||||
|
||||
+2
-12
@@ -44,16 +44,6 @@ public abstract class MatchingHandler {
|
||||
this.filter = filter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Matches given handler node against given value.
|
||||
* @param matchedNode for matching
|
||||
* @param context of the matching
|
||||
* @return true if matching was successful and false otherwise
|
||||
*/
|
||||
public boolean match(PsiElement patternNode, PsiElement matchedNode, int start, int end, MatchContext context) {
|
||||
return match(patternNode,matchedNode,context);
|
||||
}
|
||||
|
||||
/**
|
||||
* Matches given handler node against given value.
|
||||
* @param matchedNode for matching
|
||||
@@ -160,8 +150,8 @@ public abstract class MatchingHandler {
|
||||
// We do not reset certain handlers because they are also bound to higher level nodes
|
||||
// e.g. Identifier handler in name is also bound to PsiMethod
|
||||
if (pattern.isToResetHandler(element)) {
|
||||
MatchingHandler handler = pattern.getHandlerSimple(element);
|
||||
if (handler instanceof SubstitutionHandler) {
|
||||
final MatchingHandler handler = pattern.getHandlerSimple(element);
|
||||
if (handler != null) {
|
||||
handler.reset();
|
||||
}
|
||||
}
|
||||
|
||||
+2
-27
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -45,7 +45,7 @@ public class SkippingHandler extends MatchingHandler implements DelegatingHandle
|
||||
/*if (patternNode != null && matchedNode != null && patternNode.getClass() == matchedNode.getClass()) {
|
||||
//return myDelegate.match(patternNode, matchedNode, matchContext);
|
||||
}*/
|
||||
PsiElement newPatternNode = skipNodeIfNeccessary(patternNode);
|
||||
final PsiElement newPatternNode = skipNodeIfNeccessary(patternNode);
|
||||
matchedNode = skipNodeIfNeccessary(matchedNode);
|
||||
|
||||
if (newPatternNode != patternNode) {
|
||||
@@ -69,36 +69,11 @@ public class SkippingHandler extends MatchingHandler implements DelegatingHandle
|
||||
return myDelegate.matchSequentially(nodes, nodes2, context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean match(PsiElement patternNode,
|
||||
PsiElement matchedNode,
|
||||
final int start,
|
||||
final int end,
|
||||
final MatchContext context) {
|
||||
if (patternNode == null || matchedNode == null || patternNode.getClass() == matchedNode.getClass()) {
|
||||
return myDelegate.match(patternNode, matchedNode, start, end, context);
|
||||
}
|
||||
|
||||
PsiElement newPatternNode = skipNodeIfNeccessary(patternNode);
|
||||
matchedNode = skipNodeIfNeccessary(matchedNode);
|
||||
|
||||
if (newPatternNode != patternNode) {
|
||||
return context.getPattern().getHandler(newPatternNode).match(newPatternNode, matchedNode, start, end, context);
|
||||
}
|
||||
|
||||
return myDelegate.match(patternNode, matchedNode, start, end, context);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isMatchSequentiallySucceeded(final NodeIterator nodes2) {
|
||||
return myDelegate.isMatchSequentiallySucceeded(nodes2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldAdvanceTheMatchFor(PsiElement patternElement, PsiElement matchedElement) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MatchingHandler getDelegate() {
|
||||
return myDelegate;
|
||||
|
||||
+1
-7
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -81,12 +81,6 @@ public final class TopLevelMatchingHandler extends MatchingHandler implements De
|
||||
return delegate.matchSequentially(nodes, nodes2, context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean match(final PsiElement patternNode,
|
||||
final PsiElement matchedNode, final int start, final int end, final MatchContext context) {
|
||||
return match(patternNode, matchedNode, context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMatchSequentiallySucceeded(final NodeIterator nodes2) {
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user