void (@NotNull PsiReferenceExpression expression) { if(!myCanBeLambdaBody) return; super.visitReferenceExpression(expression); PsiElement element = expression.resolve(); if (element instanceof PsiVariable && !isAllowedInLambda(expression, (PsiVariable)element)) { myCanBeLambdaBody = false; } }