Search in sources :

Example 6 with SimpleFunctionDescriptorImpl

use of org.jetbrains.kotlin.descriptors.impl.SimpleFunctionDescriptorImpl in project kotlin by JetBrains.

the class ClosureCodegen method generateBridges.

protected void generateBridges() {
    FunctionDescriptor erasedInterfaceFunction;
    if (samType == null) {
        erasedInterfaceFunction = getErasedInvokeFunction(funDescriptor);
    } else {
        erasedInterfaceFunction = samType.getAbstractMethod().getOriginal();
    }
    generateBridge(typeMapper.mapAsmMethod(erasedInterfaceFunction), typeMapper.mapAsmMethod(funDescriptor));
    //TODO: rewrite cause ugly hack
    if (samType != null) {
        SimpleFunctionDescriptorImpl descriptorForBridges = SimpleFunctionDescriptorImpl.create(funDescriptor.getContainingDeclaration(), funDescriptor.getAnnotations(), erasedInterfaceFunction.getName(), CallableMemberDescriptor.Kind.DECLARATION, funDescriptor.getSource());
        descriptorForBridges.initialize(null, erasedInterfaceFunction.getDispatchReceiverParameter(), erasedInterfaceFunction.getTypeParameters(), erasedInterfaceFunction.getValueParameters(), erasedInterfaceFunction.getReturnType(), Modality.OPEN, erasedInterfaceFunction.getVisibility());
        DescriptorUtilsKt.setSingleOverridden(descriptorForBridges, erasedInterfaceFunction);
        functionCodegen.generateBridges(descriptorForBridges);
    }
}
Also used : SimpleFunctionDescriptorImpl(org.jetbrains.kotlin.descriptors.impl.SimpleFunctionDescriptorImpl)

Example 7 with SimpleFunctionDescriptorImpl

use of org.jetbrains.kotlin.descriptors.impl.SimpleFunctionDescriptorImpl in project kotlin by JetBrains.

the class MemberCodegen method createOrGetClInitCodegen.

@NotNull
public final ExpressionCodegen createOrGetClInitCodegen() {
    if (clInit == null) {
        DeclarationDescriptor contextDescriptor = context.getContextDescriptor();
        SimpleFunctionDescriptorImpl clInitDescriptor = createClInitFunctionDescriptor(contextDescriptor);
        MethodVisitor mv = createClInitMethodVisitor(contextDescriptor);
        clInit = new ExpressionCodegen(mv, new FrameMap(), Type.VOID_TYPE, context.intoFunction(clInitDescriptor), state, this);
    }
    return clInit;
}
Also used : SimpleFunctionDescriptorImpl(org.jetbrains.kotlin.descriptors.impl.SimpleFunctionDescriptorImpl) NotNull(org.jetbrains.annotations.NotNull)

Example 8 with SimpleFunctionDescriptorImpl

use of org.jetbrains.kotlin.descriptors.impl.SimpleFunctionDescriptorImpl in project kotlin by JetBrains.

the class MemberCodegen method createClInitFunctionDescriptor.

@NotNull
private SimpleFunctionDescriptorImpl createClInitFunctionDescriptor(@NotNull DeclarationDescriptor descriptor) {
    SimpleFunctionDescriptorImpl clInit = SimpleFunctionDescriptorImpl.create(descriptor, Annotations.Companion.getEMPTY(), Name.special("<clinit>"), SYNTHESIZED, KotlinSourceElementKt.toSourceElement(element));
    clInit.initialize(null, null, Collections.<TypeParameterDescriptor>emptyList(), Collections.<ValueParameterDescriptor>emptyList(), DescriptorUtilsKt.getModule(descriptor).getBuiltIns().getUnitType(), null, Visibilities.PRIVATE);
    return clInit;
}
Also used : SimpleFunctionDescriptorImpl(org.jetbrains.kotlin.descriptors.impl.SimpleFunctionDescriptorImpl) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

SimpleFunctionDescriptorImpl (org.jetbrains.kotlin.descriptors.impl.SimpleFunctionDescriptorImpl)8 NotNull (org.jetbrains.annotations.NotNull)3 Nullable (org.jetbrains.annotations.Nullable)1 ValueParameterDescriptorImpl (org.jetbrains.kotlin.descriptors.impl.ValueParameterDescriptorImpl)1 JavaClassDescriptor (org.jetbrains.kotlin.load.java.descriptors.JavaClassDescriptor)1 TracingStrategy (org.jetbrains.kotlin.resolve.calls.tasks.TracingStrategy)1