adjust ExpressionCodegen.resolveToCallable parameter type
This commit is contained in:
@@ -1315,7 +1315,7 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Callable callable = resolveToCallable(fd, superCall);
|
Callable callable = resolveToCallable((FunctionDescriptor) fd, superCall);
|
||||||
if (callable instanceof CallableMethod) {
|
if (callable instanceof CallableMethod) {
|
||||||
final CallableMethod callableMethod = (CallableMethod) callable;
|
final CallableMethod callableMethod = (CallableMethod) callable;
|
||||||
invokeMethodWithArguments(callableMethod, expression, receiver);
|
invokeMethodWithArguments(callableMethod, expression, receiver);
|
||||||
@@ -1344,7 +1344,7 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> {
|
|||||||
return StackValue.none();
|
return StackValue.none();
|
||||||
}
|
}
|
||||||
|
|
||||||
Callable resolveToCallable(DeclarationDescriptor fd, boolean superCall) {
|
Callable resolveToCallable(@NotNull FunctionDescriptor fd, boolean superCall) {
|
||||||
final IntrinsicMethod intrinsic = state.getInjector().getIntrinsics().getIntrinsic(fd);
|
final IntrinsicMethod intrinsic = state.getInjector().getIntrinsics().getIntrinsic(fd);
|
||||||
if (intrinsic != null) {
|
if (intrinsic != null) {
|
||||||
return intrinsic;
|
return intrinsic;
|
||||||
@@ -1356,14 +1356,11 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> {
|
|||||||
// callableMethod = ClosureCodegen.asCallableMethod((FunctionDescriptor) fd);
|
// callableMethod = ClosureCodegen.asCallableMethod((FunctionDescriptor) fd);
|
||||||
//}
|
//}
|
||||||
if (fd instanceof ExpressionAsFunctionDescriptor || (fd instanceof SimpleFunctionDescriptor && (fd.getContainingDeclaration() instanceof FunctionDescriptor || fd.getContainingDeclaration() instanceof ScriptDescriptor))) {
|
if (fd instanceof ExpressionAsFunctionDescriptor || (fd instanceof SimpleFunctionDescriptor && (fd.getContainingDeclaration() instanceof FunctionDescriptor || fd.getContainingDeclaration() instanceof ScriptDescriptor))) {
|
||||||
SimpleFunctionDescriptor invoke = CodegenUtil.createInvoke((FunctionDescriptor) fd);
|
SimpleFunctionDescriptor invoke = CodegenUtil.createInvoke(fd);
|
||||||
callableMethod = ClosureCodegen.asCallableMethod(invoke, typeMapper);
|
callableMethod = ClosureCodegen.asCallableMethod(invoke, typeMapper);
|
||||||
}
|
}
|
||||||
else if (fd instanceof FunctionDescriptor) {
|
|
||||||
callableMethod = typeMapper.mapToCallableMethod((FunctionDescriptor) fd, superCall, OwnerKind.IMPLEMENTATION);
|
|
||||||
}
|
|
||||||
else {
|
else {
|
||||||
throw new UnsupportedOperationException("can't resolve declaration to callable: " + fd);
|
callableMethod = typeMapper.mapToCallableMethod(fd, superCall, OwnerKind.IMPLEMENTATION);
|
||||||
}
|
}
|
||||||
return callableMethod;
|
return callableMethod;
|
||||||
}
|
}
|
||||||
@@ -1720,7 +1717,7 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
DeclarationDescriptor op = bindingContext.get(BindingContext.REFERENCE_TARGET, expression.getOperationReference());
|
DeclarationDescriptor op = bindingContext.get(BindingContext.REFERENCE_TARGET, expression.getOperationReference());
|
||||||
final Callable callable = resolveToCallable(op, false);
|
final Callable callable = resolveToCallable((FunctionDescriptor) op, false);
|
||||||
if (callable instanceof IntrinsicMethod) {
|
if (callable instanceof IntrinsicMethod) {
|
||||||
IntrinsicMethod intrinsic = (IntrinsicMethod) callable;
|
IntrinsicMethod intrinsic = (IntrinsicMethod) callable;
|
||||||
return intrinsic.generate(this, v, expressionType(expression), expression,
|
return intrinsic.generate(this, v, expressionType(expression), expression,
|
||||||
@@ -2011,7 +2008,7 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> {
|
|||||||
|
|
||||||
private StackValue generateAugmentedAssignment(JetBinaryExpression expression) {
|
private StackValue generateAugmentedAssignment(JetBinaryExpression expression) {
|
||||||
DeclarationDescriptor op = bindingContext.get(BindingContext.REFERENCE_TARGET, expression.getOperationReference());
|
DeclarationDescriptor op = bindingContext.get(BindingContext.REFERENCE_TARGET, expression.getOperationReference());
|
||||||
final Callable callable = resolveToCallable(op, false);
|
final Callable callable = resolveToCallable((FunctionDescriptor) op, false);
|
||||||
final JetExpression lhs = expression.getLeft();
|
final JetExpression lhs = expression.getLeft();
|
||||||
|
|
||||||
// if(lhs instanceof JetArrayAccessExpression) {
|
// if(lhs instanceof JetArrayAccessExpression) {
|
||||||
@@ -2123,7 +2120,7 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
DeclarationDescriptor op = bindingContext.get(BindingContext.REFERENCE_TARGET, expression.getOperationReference());
|
DeclarationDescriptor op = bindingContext.get(BindingContext.REFERENCE_TARGET, expression.getOperationReference());
|
||||||
final Callable callable = resolveToCallable(op, false);
|
final Callable callable = resolveToCallable((FunctionDescriptor) op, false);
|
||||||
if (callable instanceof IntrinsicMethod) {
|
if (callable instanceof IntrinsicMethod) {
|
||||||
IntrinsicMethod intrinsic = (IntrinsicMethod) callable;
|
IntrinsicMethod intrinsic = (IntrinsicMethod) callable;
|
||||||
return intrinsic.generate(this, v, expressionType(expression), expression,
|
return intrinsic.generate(this, v, expressionType(expression), expression,
|
||||||
@@ -2202,7 +2199,7 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> {
|
|||||||
ResolvedCall<? extends CallableDescriptor> resolvedCall = bindingContext.get(BindingContext.RESOLVED_CALL, expression.getOperationReference());
|
ResolvedCall<? extends CallableDescriptor> resolvedCall = bindingContext.get(BindingContext.RESOLVED_CALL, expression.getOperationReference());
|
||||||
assert resolvedCall != null;
|
assert resolvedCall != null;
|
||||||
|
|
||||||
final Callable callable = resolveToCallable(op, false);
|
final Callable callable = resolveToCallable((FunctionDescriptor) op, false);
|
||||||
|
|
||||||
StackValue value = gen(expression.getBaseExpression());
|
StackValue value = gen(expression.getBaseExpression());
|
||||||
value.dupReceiver(v);
|
value.dupReceiver(v);
|
||||||
|
|||||||
Reference in New Issue
Block a user