IDEA-143217 Debugger: Smart Step Into is suggested for method in inner lambda with...
authorEgor.Ushakov <egor.ushakov@jetbrains.com>
Fri, 31 Jul 2015 16:18:30 +0000 (19:18 +0300)
committerEgor.Ushakov <egor.ushakov@jetbrains.com>
Fri, 31 Jul 2015 16:20:34 +0000 (19:20 +0300)
java/debugger/impl/src/com/intellij/debugger/actions/JavaSmartStepIntoHandler.java

index 727e1b49aa82dd8718a08c477644386cc25d6f65..e23f017b6de369fcbcff7fc5c862447c48ecc17c 100644 (file)
@@ -93,6 +93,7 @@ public class JavaSmartStepIntoHandler extends JvmSmartStepIntoHandler {
         final Stack<PsiMethod> myContextStack = new Stack<PsiMethod>();
         final Stack<String> myParamNameStack = new Stack<String>();
         private int myNextLambdaExpressionOrdinal = 0;
+        private boolean myInsideLambda = false;
 
         @Nullable
         private String getCurrentParamName() {
@@ -107,7 +108,10 @@ public class JavaSmartStepIntoHandler extends JvmSmartStepIntoHandler {
         }
 
         public void visitLambdaExpression(PsiLambdaExpression expression) {
+          boolean inLambda = myInsideLambda;
+          myInsideLambda = true;
           super.visitLambdaExpression(expression);
+          myInsideLambda = inLambda;
           targets.add(new LambdaSmartStepTarget(expression, getCurrentParamName(), expression.getBody(), myNextLambdaExpressionOrdinal++, null));
         }
 
@@ -174,7 +178,7 @@ public class JavaSmartStepIntoHandler extends JvmSmartStepIntoHandler {
               expression instanceof PsiMethodCallExpression?
                 ((PsiMethodCallExpression)expression).getMethodExpression().getReferenceNameElement()
                 : expression instanceof PsiNewExpression? ((PsiNewExpression)expression).getClassOrAnonymousClassReference() : expression,
-              false,
+              myInsideLambda,
               null
             ));
           }