From e89a09f470f23285255cc1467f778fb1c40f3bb7 Mon Sep 17 00:00:00 2001 From: Svetlana Isakova Date: Tue, 3 Jul 2012 12:46:25 +0400 Subject: [PATCH] 'isFunctionLiteralWithoutDeclaredParameterTypes' added such literals are analyzed at the end of inference without initial influence on the constraint system --- .../src/org/jetbrains/jet/lang/psi/JetPsiUtil.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetPsiUtil.java b/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetPsiUtil.java index 7f1bfc94a6d..00209375a3c 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetPsiUtil.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetPsiUtil.java @@ -339,4 +339,15 @@ public class JetPsiUtil { ASTNode callOperationNode = call.getCallOperationNode(); return callOperationNode != null && callOperationNode.getElementType() == JetTokens.SAFE_ACCESS; } + + public static boolean isFunctionLiteralWithoutDeclaredParameterTypes(JetExpression expression) { + if (!(expression instanceof JetFunctionLiteralExpression)) return false; + JetFunctionLiteralExpression functionLiteral = (JetFunctionLiteralExpression) expression; + for (JetParameter parameter : functionLiteral.getValueParameters()) { + if (parameter.getTypeReference() != null) { + return false; + } + } + return true; + } }