Labels on function literal arguments are processed properly

This commit is contained in:
Andrey Breslav
2013-08-16 20:03:50 +04:00
parent 9f90fd0938
commit db70087573
6 changed files with 30 additions and 14 deletions
@@ -19,7 +19,6 @@ package org.jetbrains.jet.lang.psi;
import com.intellij.lang.ASTNode;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiReference;
import com.intellij.psi.PsiReferenceService;
import com.intellij.psi.impl.source.resolve.reference.ReferenceProvidersRegistry;
import com.intellij.util.SmartList;
import org.jetbrains.annotations.NotNull;
@@ -98,7 +97,7 @@ public class JetCallExpression extends JetReferenceExpression implements JetCall
if (JetTokens.LABELS.contains(prefixExpression.getOperationReference().getReferencedNameElementType())) {
JetExpression labeledExpression = prefixExpression.getBaseExpression();
if (labeledExpression instanceof JetFunctionLiteralExpression) {
result.add(labeledExpression);
result.add(prefixExpression);
}
}
}
@@ -215,15 +215,6 @@ import static org.jetbrains.jet.lang.resolve.calls.ValueArgumentsToParametersMap
setStatus(ERROR);
}
else {
JetFunctionLiteralExpression functionLiteral;
if (possiblyLabeledFunctionLiteral instanceof JetLabelQualifiedExpression) {
JetLabelQualifiedExpression labeledFunctionLiteral = (JetLabelQualifiedExpression) possiblyLabeledFunctionLiteral;
functionLiteral = (JetFunctionLiteralExpression) labeledFunctionLiteral.getLabeledExpression();
}
else {
functionLiteral = (JetFunctionLiteralExpression) possiblyLabeledFunctionLiteral;
}
ValueParameterDescriptor valueParameterDescriptor = valueParameters.get(valueParameters.size() - 1);
if (valueParameterDescriptor.getVarargElementType() != null) {
report(VARARG_OUTSIDE_PARENTHESES.on(possiblyLabeledFunctionLiteral));
@@ -235,7 +226,7 @@ import static org.jetbrains.jet.lang.resolve.calls.ValueArgumentsToParametersMap
setStatus(WEAK_ERROR);
}
else {
putVararg(valueParameterDescriptor, CallMaker.makeValueArgument(functionLiteral));
putVararg(valueParameterDescriptor, CallMaker.makeValueArgument(possiblyLabeledFunctionLiteral));
}
}
}