extract method
This commit is contained in:
@@ -1355,7 +1355,7 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> {
|
|||||||
// assert !superCall;
|
// assert !superCall;
|
||||||
// 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 (isCallAsFunctionObject(fd)) {
|
||||||
SimpleFunctionDescriptor invoke = CodegenUtil.createInvoke(fd);
|
SimpleFunctionDescriptor invoke = CodegenUtil.createInvoke(fd);
|
||||||
callableMethod = ClosureCodegen.asCallableMethod(invoke, typeMapper);
|
callableMethod = ClosureCodegen.asCallableMethod(invoke, typeMapper);
|
||||||
}
|
}
|
||||||
@@ -1365,6 +1365,11 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> {
|
|||||||
return callableMethod;
|
return callableMethod;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean isCallAsFunctionObject(FunctionDescriptor fd) {
|
||||||
|
return fd instanceof ExpressionAsFunctionDescriptor
|
||||||
|
|| (fd instanceof SimpleFunctionDescriptor && (fd.getContainingDeclaration() instanceof FunctionDescriptor || fd.getContainingDeclaration() instanceof ScriptDescriptor));
|
||||||
|
}
|
||||||
|
|
||||||
public void invokeMethodWithArguments(CallableMethod callableMethod, JetCallElement expression, StackValue receiver) {
|
public void invokeMethodWithArguments(CallableMethod callableMethod, JetCallElement expression, StackValue receiver) {
|
||||||
final Type calleeType = callableMethod.getGenerateCalleeType();
|
final Type calleeType = callableMethod.getGenerateCalleeType();
|
||||||
if (calleeType != null && expression instanceof JetCallExpression) {
|
if (calleeType != null && expression instanceof JetCallExpression) {
|
||||||
|
|||||||
Reference in New Issue
Block a user