Remove experimental coroutines wrapper generation
This commit is contained in:
committed by
TeamCityServer
parent
1f8dd45c2b
commit
97176b5d60
@@ -331,8 +331,6 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
|
|||||||
|
|
||||||
StackValue stackValue = selector.accept(visitor, receiver);
|
StackValue stackValue = selector.accept(visitor, receiver);
|
||||||
|
|
||||||
stackValue = suspendFunctionTypeWrapperIfNeeded(selector, stackValue);
|
|
||||||
|
|
||||||
stackValue = coerceAndBoxInlineClassIfNeeded(selector, stackValue);
|
stackValue = coerceAndBoxInlineClassIfNeeded(selector, stackValue);
|
||||||
|
|
||||||
RuntimeAssertionInfo runtimeAssertionInfo = null;
|
RuntimeAssertionInfo runtimeAssertionInfo = null;
|
||||||
@@ -357,32 +355,6 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private StackValue suspendFunctionTypeWrapperIfNeeded(KtElement selector, StackValue stackValue) {
|
|
||||||
Type functionTypeForWrapper =
|
|
||||||
selector instanceof KtExpression
|
|
||||||
? bindingContext.get(CodegenBinding.FUNCTION_TYPE_FOR_SUSPEND_WRAPPER, (KtExpression) selector)
|
|
||||||
: null;
|
|
||||||
|
|
||||||
if (functionTypeForWrapper == null) return stackValue;
|
|
||||||
|
|
||||||
StackValue stackValueToWrap = stackValue;
|
|
||||||
stackValue = new StackValue(stackValue.type, stackValue.kotlinType) {
|
|
||||||
@Override
|
|
||||||
public void putSelector(
|
|
||||||
@NotNull Type type, @Nullable KotlinType kotlinType, @NotNull InstructionAdapter v
|
|
||||||
) {
|
|
||||||
stackValueToWrap.put(functionTypeForWrapper, null, v);
|
|
||||||
invokeCoroutineMigrationMethod(
|
|
||||||
v,
|
|
||||||
"toExperimentalSuspendFunction",
|
|
||||||
Type.getMethodDescriptor(functionTypeForWrapper, functionTypeForWrapper)
|
|
||||||
);
|
|
||||||
coerce(functionTypeForWrapper, type, v);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
return stackValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
private StackValue coerceAndBoxInlineClassIfNeeded(KtElement selector, StackValue stackValue) {
|
private StackValue coerceAndBoxInlineClassIfNeeded(KtElement selector, StackValue stackValue) {
|
||||||
ResolvedCall<? extends CallableDescriptor> resolvedCall = CallUtilKt.getResolvedCall(selector, bindingContext);
|
ResolvedCall<? extends CallableDescriptor> resolvedCall = CallUtilKt.getResolvedCall(selector, bindingContext);
|
||||||
if (resolvedCall == null) return stackValue;
|
if (resolvedCall == null) return stackValue;
|
||||||
@@ -2619,19 +2591,6 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
|
|||||||
tempVariables.put(continuationExpression, coroutineInstanceValue);
|
tempVariables.put(continuationExpression, coroutineInstanceValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void invokeCoroutineMigrationMethod(
|
|
||||||
@NotNull InstructionAdapter v,
|
|
||||||
String methodName,
|
|
||||||
String descriptor
|
|
||||||
) {
|
|
||||||
v.invokestatic(
|
|
||||||
"kotlin/coroutines/experimental/migration/CoroutinesMigrationKt",
|
|
||||||
methodName,
|
|
||||||
descriptor,
|
|
||||||
false
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
private StackValue getContinuationParameterFromEnclosingSuspendFunction(@NotNull ResolvedCall<?> resolvedCall) {
|
private StackValue getContinuationParameterFromEnclosingSuspendFunction(@NotNull ResolvedCall<?> resolvedCall) {
|
||||||
FunctionDescriptor enclosingSuspendFunction =
|
FunctionDescriptor enclosingSuspendFunction =
|
||||||
bindingContext.get(BindingContext.ENCLOSING_SUSPEND_FUNCTION_FOR_SUSPEND_FUNCTION_CALL, resolvedCall.getCall());
|
bindingContext.get(BindingContext.ENCLOSING_SUSPEND_FUNCTION_FOR_SUSPEND_FUNCTION_CALL, resolvedCall.getCall());
|
||||||
|
|||||||
@@ -45,7 +45,6 @@ public class CodegenBinding {
|
|||||||
private static final WritableSlice<ClassDescriptor, Collection<ClassDescriptor>> INNER_CLASSES = Slices.createSimpleSlice();
|
private static final WritableSlice<ClassDescriptor, Collection<ClassDescriptor>> INNER_CLASSES = Slices.createSimpleSlice();
|
||||||
|
|
||||||
public static final WritableSlice<KtExpression, SamType> SAM_VALUE = Slices.createSimpleSlice();
|
public static final WritableSlice<KtExpression, SamType> SAM_VALUE = Slices.createSimpleSlice();
|
||||||
public static final WritableSlice<KtExpression, Type> FUNCTION_TYPE_FOR_SUSPEND_WRAPPER = Slices.createSimpleSlice();
|
|
||||||
|
|
||||||
public static final WritableSlice<KtCallElement, KtExpression> SAM_CONSTRUCTOR_TO_ARGUMENT = Slices.createSimpleSlice();
|
public static final WritableSlice<KtCallElement, KtExpression> SAM_CONSTRUCTOR_TO_ARGUMENT = Slices.createSimpleSlice();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user