Search in sources :

Example 1 with JvmDeclarationOrigin

use of org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOrigin in project kotlin by JetBrains.

the class FunctionCodegen method genDelegate.

public void genDelegate(@NotNull FunctionDescriptor delegateFunction, FunctionDescriptor delegatedTo, ClassDescriptor toClass, StackValue field) {
    JvmDeclarationOrigin declarationOrigin = JvmDeclarationOriginKt.Delegation(DescriptorToSourceUtils.descriptorToDeclaration(delegatedTo), delegateFunction);
    genDelegate(delegateFunction, delegatedTo, declarationOrigin, toClass, field);
}
Also used : JvmDeclarationOrigin(org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOrigin)

Example 2 with JvmDeclarationOrigin

use of org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOrigin in project kotlin by JetBrains.

the class ImplementationBodyCodegen method generatePrimaryConstructor.

private void generatePrimaryConstructor(final DelegationFieldsInfo delegationFieldsInfo) {
    if (isInterface(descriptor) || isAnnotationClass(descriptor))
        return;
    final ClassConstructorDescriptor constructorDescriptor = descriptor.getUnsubstitutedPrimaryConstructor();
    if (constructorDescriptor == null)
        return;
    ConstructorContext constructorContext = context.intoConstructor(constructorDescriptor);
    final KtPrimaryConstructor primaryConstructor = myClass.getPrimaryConstructor();
    JvmDeclarationOrigin origin = JvmDeclarationOriginKt.OtherOrigin(primaryConstructor != null ? primaryConstructor : myClass.getPsiOrParent(), constructorDescriptor);
    functionCodegen.generateMethod(origin, constructorDescriptor, constructorContext, new FunctionGenerationStrategy.CodegenBased(state) {

        @Override
        public void doGenerateBody(@NotNull ExpressionCodegen codegen, @NotNull JvmMethodSignature signature) {
            generatePrimaryConstructorImpl(constructorDescriptor, codegen, delegationFieldsInfo, primaryConstructor);
        }
    });
    functionCodegen.generateDefaultIfNeeded(constructorContext, constructorDescriptor, OwnerKind.IMPLEMENTATION, DefaultParameterValueLoader.DEFAULT, null);
    new DefaultParameterValueSubstitutor(state).generatePrimaryConstructorOverloadsIfNeeded(constructorDescriptor, v, this, kind, myClass);
}
Also used : JvmMethodSignature(org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodSignature) JvmDeclarationOrigin(org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOrigin)

Example 3 with JvmDeclarationOrigin

use of org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOrigin in project kotlin by JetBrains.

the class FunctionCodegen method genSamDelegate.

public void genSamDelegate(@NotNull FunctionDescriptor functionDescriptor, FunctionDescriptor overriddenDescriptor, StackValue field) {
    FunctionDescriptor delegatedTo = overriddenDescriptor.getOriginal();
    JvmDeclarationOrigin declarationOrigin = JvmDeclarationOriginKt.SamDelegation(functionDescriptor);
    genDelegate(functionDescriptor, delegatedTo, declarationOrigin, (ClassDescriptor) overriddenDescriptor.getContainingDeclaration(), field);
}
Also used : JvmDeclarationOrigin(org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOrigin)

Aggregations

JvmDeclarationOrigin (org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOrigin)3 JvmMethodSignature (org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodSignature)1