Fix compilation
This commit is contained in:
committed by
Stanislav Erokhin
parent
1ab003c029
commit
5a6b4a3224
+7
-19
@@ -5424,12 +5424,6 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("lambdaParameters.kt")
|
|
||||||
public void testLambdaParameters() throws Exception {
|
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/coroutines/lambdaParameters.kt");
|
|
||||||
doTest(fileName);
|
|
||||||
}
|
|
||||||
|
|
||||||
@TestMetadata("lastExpressionIsLoop.kt")
|
@TestMetadata("lastExpressionIsLoop.kt")
|
||||||
public void testLastExpressionIsLoop() throws Exception {
|
public void testLastExpressionIsLoop() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/coroutines/lastExpressionIsLoop.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/coroutines/lastExpressionIsLoop.kt");
|
||||||
@@ -5454,18 +5448,6 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("manualContinuationImpl.kt")
|
|
||||||
public void testManualContinuationImpl() throws Exception {
|
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/coroutines/manualContinuationImpl.kt");
|
|
||||||
try {
|
|
||||||
doTest(fileName);
|
|
||||||
}
|
|
||||||
catch (Throwable ignore) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
throw new AssertionError("Looks like this test can be unmuted. Remove IGNORE_BACKEND directive for that.");
|
|
||||||
}
|
|
||||||
|
|
||||||
@TestMetadata("multipleInvokeCalls.kt")
|
@TestMetadata("multipleInvokeCalls.kt")
|
||||||
public void testMultipleInvokeCalls() throws Exception {
|
public void testMultipleInvokeCalls() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/coroutines/multipleInvokeCalls.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/coroutines/multipleInvokeCalls.kt");
|
||||||
@@ -5523,7 +5505,13 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
|||||||
@TestMetadata("simple.kt")
|
@TestMetadata("simple.kt")
|
||||||
public void testSimple() throws Exception {
|
public void testSimple() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/coroutines/simple.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/coroutines/simple.kt");
|
||||||
doTest(fileName);
|
try {
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
catch (Throwable ignore) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
throw new AssertionError("Looks like this test can be unmuted. Remove IGNORE_BACKEND directive for that.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("simpleException.kt")
|
@TestMetadata("simpleException.kt")
|
||||||
|
|||||||
-16
@@ -18,7 +18,6 @@ package org.jetbrains.kotlin.js.translate.expression
|
|||||||
|
|
||||||
import com.google.dart.compiler.backend.js.ast.*
|
import com.google.dart.compiler.backend.js.ast.*
|
||||||
import com.google.dart.compiler.backend.js.ast.metadata.*
|
import com.google.dart.compiler.backend.js.ast.metadata.*
|
||||||
import org.jetbrains.kotlin.backend.common.findInterceptResume
|
|
||||||
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
|
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
|
||||||
import org.jetbrains.kotlin.descriptors.*
|
import org.jetbrains.kotlin.descriptors.*
|
||||||
import org.jetbrains.kotlin.descriptors.impl.ValueParameterDescriptorImpl
|
import org.jetbrains.kotlin.descriptors.impl.ValueParameterDescriptorImpl
|
||||||
@@ -97,8 +96,6 @@ class LiteralFunctionTranslator(context: TranslationContext) : AbstractTranslato
|
|||||||
null
|
null
|
||||||
}
|
}
|
||||||
|
|
||||||
val interceptResumeRef = controllerType?.let { context().generateInterceptResumeRef(it) }
|
|
||||||
|
|
||||||
if (tracker.hasCapturedExceptContaining()) {
|
if (tracker.hasCapturedExceptContaining()) {
|
||||||
val lambdaCreator = simpleReturnFunction(invokingContext.scope(), lambda)
|
val lambdaCreator = simpleReturnFunction(invokingContext.scope(), lambda)
|
||||||
lambdaCreator.name = invokingContext.getInnerNameForDescriptor(descriptor)
|
lambdaCreator.name = invokingContext.getInnerNameForDescriptor(descriptor)
|
||||||
@@ -111,7 +108,6 @@ class LiteralFunctionTranslator(context: TranslationContext) : AbstractTranslato
|
|||||||
lambdaCreator.name.staticRef = lambdaCreator
|
lambdaCreator.name.staticRef = lambdaCreator
|
||||||
lambdaCreator.continuationInterfaceRef = invokingContext.getContinuationInterfaceReference()
|
lambdaCreator.continuationInterfaceRef = invokingContext.getContinuationInterfaceReference()
|
||||||
lambdaCreator.suspendObjectRef = suspendObjectRef
|
lambdaCreator.suspendObjectRef = suspendObjectRef
|
||||||
lambdaCreator.interceptResumeRef = interceptResumeRef
|
|
||||||
return lambdaCreator.withCapturedParameters(descriptor, descriptor.wrapContextForCoroutineIfNecessary(functionContext),
|
return lambdaCreator.withCapturedParameters(descriptor, descriptor.wrapContextForCoroutineIfNecessary(functionContext),
|
||||||
invokingContext)
|
invokingContext)
|
||||||
}
|
}
|
||||||
@@ -124,7 +120,6 @@ class LiteralFunctionTranslator(context: TranslationContext) : AbstractTranslato
|
|||||||
lambda.name.staticRef = lambda
|
lambda.name.staticRef = lambda
|
||||||
lambda.continuationInterfaceRef = invokingContext.getContinuationInterfaceReference()
|
lambda.continuationInterfaceRef = invokingContext.getContinuationInterfaceReference()
|
||||||
lambda.suspendObjectRef = suspendObjectRef
|
lambda.suspendObjectRef = suspendObjectRef
|
||||||
lambda.interceptResumeRef = interceptResumeRef
|
|
||||||
return getReferenceToLambda(invokingContext, descriptor, lambda.name)
|
return getReferenceToLambda(invokingContext, descriptor, lambda.name)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -206,17 +201,6 @@ private fun getReferenceToLambda(context: TranslationContext, descriptor: Callab
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun TranslationContext.generateInterceptResumeRef(classDescriptor: ClassDescriptor): JsExpression? {
|
|
||||||
val interceptResumeFunction = classDescriptor.defaultType.findInterceptResume()
|
|
||||||
return if (interceptResumeFunction != null) {
|
|
||||||
val controllerRef = JsNameRef("\$\$controller\$\$", JsLiteral.THIS).apply { coroutineController = true }
|
|
||||||
JsNameRef(getNameForDescriptor(interceptResumeFunction), controllerRef)
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private data class CapturedArgsParams(val arguments: List<JsExpression> = listOf(), val parameters: List<JsParameter> = listOf())
|
private data class CapturedArgsParams(val arguments: List<JsExpression> = listOf(), val parameters: List<JsParameter> = listOf())
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -38,9 +38,8 @@ import org.jetbrains.kotlin.resolve.BindingContext;
|
|||||||
import org.jetbrains.kotlin.resolve.DescriptorUtils;
|
import org.jetbrains.kotlin.resolve.DescriptorUtils;
|
||||||
import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall;
|
import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall;
|
||||||
import org.jetbrains.kotlin.resolve.calls.model.ResolvedValueArgument;
|
import org.jetbrains.kotlin.resolve.calls.model.ResolvedValueArgument;
|
||||||
import org.jetbrains.kotlin.resolve.coroutine.CoroutineReceiverValue;
|
|
||||||
import org.jetbrains.kotlin.resolve.scopes.receivers.ImplicitReceiver;
|
|
||||||
import org.jetbrains.kotlin.resolve.inline.InlineUtil;
|
import org.jetbrains.kotlin.resolve.inline.InlineUtil;
|
||||||
|
import org.jetbrains.kotlin.resolve.scopes.receivers.ImplicitReceiver;
|
||||||
import org.jetbrains.kotlin.types.KotlinType;
|
import org.jetbrains.kotlin.types.KotlinType;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -357,14 +356,9 @@ public final class TranslationUtils {
|
|||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public static JsExpression translateContinuationArgument(@NotNull TranslationContext context, @NotNull ResolvedCall<?> resolvedCall) {
|
public static JsExpression translateContinuationArgument(@NotNull TranslationContext context, @NotNull ResolvedCall<?> resolvedCall) {
|
||||||
CoroutineReceiverValue coroutineReceiver = context.bindingContext().get(
|
CallableDescriptor continuationDescriptor =
|
||||||
BindingContext.COROUTINE_RECEIVER_FOR_SUSPENSION_POINT,
|
context.bindingContext().get(BindingContext.ENCLOSING_SUSPEND_LAMBDA_FOR_SUSPENSION_POINT, resolvedCall.getCall());
|
||||||
resolvedCall.getCall());
|
|
||||||
|
|
||||||
CallableDescriptor continuationDescriptor = null;
|
|
||||||
if (coroutineReceiver != null) {
|
|
||||||
continuationDescriptor = coroutineReceiver.getDeclarationDescriptor();
|
|
||||||
}
|
|
||||||
if (continuationDescriptor == null) {
|
if (continuationDescriptor == null) {
|
||||||
continuationDescriptor = getEnclosingContinuationParameter(context);
|
continuationDescriptor = getEnclosingContinuationParameter(context);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user