Fix compilation

This commit is contained in:
Denis Zharkov
2016-12-14 20:11:39 +03:00
committed by Stanislav Erokhin
parent 1ab003c029
commit 5a6b4a3224
3 changed files with 10 additions and 44 deletions
@@ -5424,12 +5424,6 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
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")
public void testLastExpressionIsLoop() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/coroutines/lastExpressionIsLoop.kt");
@@ -5454,18 +5448,6 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
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")
public void testMultipleInvokeCalls() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/coroutines/multipleInvokeCalls.kt");
@@ -5523,7 +5505,13 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
@TestMetadata("simple.kt")
public void testSimple() throws Exception {
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")
@@ -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.metadata.*
import org.jetbrains.kotlin.backend.common.findInterceptResume
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
import org.jetbrains.kotlin.descriptors.*
import org.jetbrains.kotlin.descriptors.impl.ValueParameterDescriptorImpl
@@ -97,8 +96,6 @@ class LiteralFunctionTranslator(context: TranslationContext) : AbstractTranslato
null
}
val interceptResumeRef = controllerType?.let { context().generateInterceptResumeRef(it) }
if (tracker.hasCapturedExceptContaining()) {
val lambdaCreator = simpleReturnFunction(invokingContext.scope(), lambda)
lambdaCreator.name = invokingContext.getInnerNameForDescriptor(descriptor)
@@ -111,7 +108,6 @@ class LiteralFunctionTranslator(context: TranslationContext) : AbstractTranslato
lambdaCreator.name.staticRef = lambdaCreator
lambdaCreator.continuationInterfaceRef = invokingContext.getContinuationInterfaceReference()
lambdaCreator.suspendObjectRef = suspendObjectRef
lambdaCreator.interceptResumeRef = interceptResumeRef
return lambdaCreator.withCapturedParameters(descriptor, descriptor.wrapContextForCoroutineIfNecessary(functionContext),
invokingContext)
}
@@ -124,7 +120,6 @@ class LiteralFunctionTranslator(context: TranslationContext) : AbstractTranslato
lambda.name.staticRef = lambda
lambda.continuationInterfaceRef = invokingContext.getContinuationInterfaceReference()
lambda.suspendObjectRef = suspendObjectRef
lambda.interceptResumeRef = interceptResumeRef
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())
/**
@@ -38,9 +38,8 @@ import org.jetbrains.kotlin.resolve.BindingContext;
import org.jetbrains.kotlin.resolve.DescriptorUtils;
import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall;
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.scopes.receivers.ImplicitReceiver;
import org.jetbrains.kotlin.types.KotlinType;
import java.util.ArrayList;
@@ -357,14 +356,9 @@ public final class TranslationUtils {
@NotNull
public static JsExpression translateContinuationArgument(@NotNull TranslationContext context, @NotNull ResolvedCall<?> resolvedCall) {
CoroutineReceiverValue coroutineReceiver = context.bindingContext().get(
BindingContext.COROUTINE_RECEIVER_FOR_SUSPENSION_POINT,
resolvedCall.getCall());
CallableDescriptor continuationDescriptor =
context.bindingContext().get(BindingContext.ENCLOSING_SUSPEND_LAMBDA_FOR_SUSPENSION_POINT, resolvedCall.getCall());
CallableDescriptor continuationDescriptor = null;
if (coroutineReceiver != null) {
continuationDescriptor = coroutineReceiver.getDeclarationDescriptor();
}
if (continuationDescriptor == null) {
continuationDescriptor = getEnclosingContinuationParameter(context);
}