Skip to content

Commit 082d599

Browse files
committed
Find binding when matching LambdaExpression
1 parent 9c8ecac commit 082d599

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

org.eclipse.jdt.core.javac/src/org/eclipse/jdt/internal/core/search/DOMASTNodeUtils.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
import org.eclipse.jdt.core.dom.IVariableBinding;
3333
import org.eclipse.jdt.core.dom.ImportDeclaration;
3434
import org.eclipse.jdt.core.dom.Initializer;
35+
import org.eclipse.jdt.core.dom.LambdaExpression;
3536
import org.eclipse.jdt.core.dom.MemberValuePair;
3637
import org.eclipse.jdt.core.dom.MethodDeclaration;
3738
import org.eclipse.jdt.core.dom.MethodInvocation;
@@ -70,6 +71,7 @@ public static IJavaElement getEnclosingJavaElement(ASTNode node) {
7071
|| node instanceof ModuleDeclaration
7172
|| node instanceof AnnotationTypeMemberDeclaration
7273
|| node instanceof Initializer
74+
|| node instanceof LambdaExpression
7375
|| node.getLocationInParent() == FieldDeclaration.FRAGMENTS_PROPERTY) {
7476
return getDeclaringJavaElement(node);
7577
}
@@ -247,6 +249,9 @@ public static IBinding getBinding(ASTNode astNode) {
247249
if (astNode instanceof ModuleDeclaration ref) {
248250
return ref.resolveBinding();
249251
}
252+
if (astNode instanceof LambdaExpression lambda) {
253+
return lambda.resolveMethodBinding();
254+
}
250255
// TODO more...
251256
return null;
252257
}

0 commit comments

Comments
 (0)