
commonMain.co.touchlab.skie.kir.irbuilder.util.ValueParameterCopy.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of kotlin-plugin Show documentation
Show all versions of kotlin-plugin Show documentation
Kotlin compiler plugin that improves Swift interface of a Kotlin Multiplatform framework.
The newest version!
package co.touchlab.skie.kir.irbuilder.util
import org.jetbrains.kotlin.descriptors.CallableDescriptor
import org.jetbrains.kotlin.descriptors.ValueParameterDescriptor
import org.jetbrains.kotlin.descriptors.annotations.Annotations
import org.jetbrains.kotlin.descriptors.impl.ValueParameterDescriptorImpl
import org.jetbrains.kotlin.types.KotlinType
fun List.copyWithoutDefaultValue(
newOwner: CallableDescriptor,
): List =
this.mapIndexed { index, valueParameter -> valueParameter.copyWithoutDefaultValue(newOwner, index) }
fun ValueParameterDescriptor.copyWithoutDefaultValue(
newOwner: CallableDescriptor,
newIndex: Int = this.index,
newType: KotlinType = this.type,
): ValueParameterDescriptor = ValueParameterDescriptorImpl(
containingDeclaration = newOwner,
original = null,
index = newIndex,
annotations = Annotations.EMPTY,
name = this.name,
outType = newType,
declaresDefaultValue = false,
isCrossinline = this.isCrossinline,
isNoinline = this.isNoinline,
varargElementType = this.varargElementType,
source = newOwner.source,
)
© 2015 - 2025 Weber Informatics LLC | Privacy Policy