![JAR search and dependency download from the Maven repository](/logo.png)
commonMain.co.touchlab.skie.phases.memberconflicts.RenameParametersNamedSelfPhase.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.phases.memberconflicts
import co.touchlab.skie.phases.SirPhase
import co.touchlab.skie.sir.element.SirSimpleFunction
import co.touchlab.skie.util.collisionFreeIdentifier
object RenameParametersNamedSelfPhase : SirPhase {
context(SirPhase.Context)
override fun execute() {
sirProvider.allSkieGeneratedSimpleFunctions
.forEach {
renameParametersNamedSelf(it)
}
}
private fun renameParametersNamedSelf(function: SirSimpleFunction) {
function.valueParameters
.filter { it.name == "self" }
.forEach { parameter ->
val existingNames = function.valueParameters.map { it.name }
parameter.name = "self".collisionFreeIdentifier(existingNames)
parameter.label = parameter.label ?: "self"
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy