makeFakeCall() uses a fake expression
This commit is contained in:
@@ -2676,7 +2676,7 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> {
|
|||||||
ResolvedCall<FunctionDescriptor> resolvedCall =
|
ResolvedCall<FunctionDescriptor> resolvedCall =
|
||||||
bindingContext.get(BindingContext.COMPONENT_RESOLVED_CALL, variableDeclaration);
|
bindingContext.get(BindingContext.COMPONENT_RESOLVED_CALL, variableDeclaration);
|
||||||
assert resolvedCall != null : "Resolved call is null for " + variableDeclaration.getText();
|
assert resolvedCall != null : "Resolved call is null for " + variableDeclaration.getText();
|
||||||
Call call = CallMaker.makeCall(initializerAsReceiver, (JetExpression) null);
|
Call call = makeFakeCall(initializerAsReceiver);
|
||||||
invokeFunction(call, StackValue.none(), resolvedCall);
|
invokeFunction(call, StackValue.none(), resolvedCall);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -3419,8 +3419,14 @@ The "returned" value of try expression with no finally is either the last expres
|
|||||||
v.athrow();
|
v.athrow();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Call makeFakeCall(ReceiverDescriptor initializerAsReceiver) {
|
||||||
|
JetSimpleNameExpression fake = JetPsiFactory.createSimpleName(state.getInjector().getProject(), "fake");
|
||||||
|
return CallMaker.makeCall(fake, initializerAsReceiver);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return context.getContextDescriptor().toString();
|
return context.getContextDescriptor().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -76,16 +76,16 @@ public class CallMaker {
|
|||||||
|
|
||||||
private final PsiElement callElement;
|
private final PsiElement callElement;
|
||||||
private final ReceiverDescriptor explicitReceiver;
|
private final ReceiverDescriptor explicitReceiver;
|
||||||
private ASTNode callOperationNode;
|
private final ASTNode callOperationNode;
|
||||||
private final JetExpression calleeExpression;
|
private final JetExpression calleeExpression;
|
||||||
private final List<? extends ValueArgument> valueArguments;
|
private final List<? extends ValueArgument> valueArguments;
|
||||||
private final Call.CallType callType;
|
private final Call.CallType callType;
|
||||||
|
|
||||||
protected CallImpl(@Nullable PsiElement callElement, @NotNull ReceiverDescriptor explicitReceiver, @Nullable ASTNode callOperationNode, @Nullable JetExpression calleeExpression, @NotNull List<? extends ValueArgument> valueArguments) {
|
protected CallImpl(@NotNull PsiElement callElement, @NotNull ReceiverDescriptor explicitReceiver, @Nullable ASTNode callOperationNode, @Nullable JetExpression calleeExpression, @NotNull List<? extends ValueArgument> valueArguments) {
|
||||||
this(callElement, explicitReceiver, callOperationNode, calleeExpression, valueArguments, CallType.DEFAULT);
|
this(callElement, explicitReceiver, callOperationNode, calleeExpression, valueArguments, CallType.DEFAULT);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected CallImpl(@Nullable PsiElement callElement, @NotNull ReceiverDescriptor explicitReceiver, @Nullable ASTNode callOperationNode,
|
protected CallImpl(@NotNull PsiElement callElement, @NotNull ReceiverDescriptor explicitReceiver, @Nullable ASTNode callOperationNode,
|
||||||
@Nullable JetExpression calleeExpression, @NotNull List<? extends ValueArgument> valueArguments, @NotNull CallType callType) {
|
@Nullable JetExpression calleeExpression, @NotNull List<? extends ValueArgument> valueArguments, @NotNull CallType callType) {
|
||||||
this.callElement = callElement;
|
this.callElement = callElement;
|
||||||
this.explicitReceiver = explicitReceiver;
|
this.explicitReceiver = explicitReceiver;
|
||||||
@@ -238,31 +238,37 @@ public class CallMaker {
|
|||||||
return ReceiverDescriptor.NO_RECEIVER;
|
return ReceiverDescriptor.NO_RECEIVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
@Nullable
|
@Nullable
|
||||||
public JetExpression getCalleeExpression() {
|
public JetExpression getCalleeExpression() {
|
||||||
return callElement.getCalleeExpression();
|
return callElement.getCalleeExpression();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
@Nullable
|
@Nullable
|
||||||
public JetValueArgumentList getValueArgumentList() {
|
public JetValueArgumentList getValueArgumentList() {
|
||||||
return callElement.getValueArgumentList();
|
return callElement.getValueArgumentList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
@NotNull
|
@NotNull
|
||||||
public List<? extends ValueArgument> getValueArguments() {
|
public List<? extends ValueArgument> getValueArguments() {
|
||||||
return callElement.getValueArguments();
|
return callElement.getValueArguments();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
@NotNull
|
@NotNull
|
||||||
public List<JetExpression> getFunctionLiteralArguments() {
|
public List<JetExpression> getFunctionLiteralArguments() {
|
||||||
return callElement.getFunctionLiteralArguments();
|
return callElement.getFunctionLiteralArguments();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
@NotNull
|
@NotNull
|
||||||
public List<JetTypeProjection> getTypeArguments() {
|
public List<JetTypeProjection> getTypeArguments() {
|
||||||
return callElement.getTypeArguments();
|
return callElement.getTypeArguments();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
@Nullable
|
@Nullable
|
||||||
public JetTypeArgumentList getTypeArgumentList() {
|
public JetTypeArgumentList getTypeArgumentList() {
|
||||||
return callElement.getTypeArgumentList();
|
return callElement.getTypeArgumentList();
|
||||||
@@ -287,7 +293,7 @@ public class CallMaker {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Call makeCall(@NotNull ReceiverDescriptor explicitReceiver, @Nullable JetExpression calleeExpression) {
|
public static Call makeCall(@NotNull JetElement callElement, @NotNull ReceiverDescriptor explicitReceiver) {
|
||||||
return new CallImpl(null, explicitReceiver, null, calleeExpression, Collections.<ValueArgument>emptyList());
|
return new CallImpl(callElement, explicitReceiver, null, null, Collections.<ValueArgument>emptyList());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user