Properly process this in callee position

This commit is contained in:
Andrey Breslav
2013-12-03 17:51:07 +04:00
parent b15b075484
commit 163e5cfbb4
6 changed files with 63 additions and 1 deletions
@@ -190,7 +190,19 @@ public class JetControlFlowProcessor {
@Override
public void visitThisExpression(@NotNull JetThisExpression expression) {
ResolvedCall<?> resolvedCall = getResolvedCall(expression);
builder.readThis(expression, resolvedCall == null ? null : (ReceiverParameterDescriptor) resolvedCall.getResultingDescriptor());
if (resolvedCall == null) {
builder.readThis(expression, null);
return;
}
CallableDescriptor resultingDescriptor = resolvedCall.getResultingDescriptor();
if (resultingDescriptor instanceof ReceiverParameterDescriptor) {
builder.readThis(expression, (ReceiverParameterDescriptor) resultingDescriptor);
}
else if (resultingDescriptor instanceof ExpressionAsFunctionDescriptor) {
// TODO: no information about actual target
builder.readThis(expression, null);
}
}
@Override