SSR: fix lambda matching problem

This commit is contained in:
Bas Leijdekkers
2014-12-30 20:22:27 +01:00
parent 2cf09010da
commit e257ec9f55
2 changed files with 4 additions and 1 deletions
@@ -392,7 +392,7 @@ public class JavaMatchingVisitor extends JavaElementVisitor {
result = myMatchingVisitor.matchSons(parameterList1, expression2.getParameterList());
}
final PsiElement body1 = getElementToMatch(expression.getBody());
if (body1 != null) {
if (body1 != null && result) {
result = myMatchingVisitor.matchSequentially(body1, getElementToMatch(expression2.getBody()));
}
myMatchingVisitor.setResult(result);
@@ -2955,6 +2955,9 @@ public class StructuralSearchTest extends StructuralSearchTestCase {
String pattern5 = "()->{/*comment*/}";
assertEquals("should find lambdas with comment body", 1, findMatchesCount(source, pattern5));
String pattern6 = "('_Parameter+) -> System.out.println()";
assertEquals("should find lambdas with at least one parameter and matching body", 0, findMatchesCount(source, pattern6));
}
public void testFindDefaultMethods() {