com.lightningkite.khrysalis.replacements.TemplatePart.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of kotlin-compiler-plugin-common Show documentation
Show all versions of kotlin-compiler-plugin-common Show documentation
Common translational tools between Typescript and Swift.
The newest version!
package com.lightningkite.khrysalis.replacements
sealed class TemplatePart {
sealed class Expression: TemplatePart()
data class Text(val string: String) : TemplatePart() {
override fun toString(): String = string
}
object Receiver : Expression() { override fun toString() = "~this~" }
object DispatchReceiver : Expression() { override fun toString() = "~thisDispatch~" }
object ExtensionReceiver : Expression() { override fun toString() = "~thisExtension~" }
object Value : Expression() { override fun toString() = "~value~" }
object AllParameters: TemplatePart() { override fun toString() = "~*~" }
object OperatorToken: TemplatePart() { override fun toString() = "~operatorToken~" }
data class Parameter(val name: String) : Expression(), TemplatePartIsParameter {
override fun toString(): String = "~$name~"
}
data class TypeParameter(val name: String) : TemplatePart() {
override fun toString(): String = "~$name~"
}
data class LambdaParameterContents(
val pointer: TemplatePartIsParameter,
val paramMap: List
) : TemplatePart() {
override fun toString(): String = when(pointer){
is ParameterByIndex -> "~L${pointer.index}~"
is Parameter -> "~L${pointer.name}~"
else -> "~L?~"
}
}
data class ParameterByIndex(val index: Int) : Expression(), TemplatePartIsParameter {
override fun toString(): String = "~$index~"
}
data class TypeParameterByIndex(val index: Int) : TemplatePart() {
override fun toString(): String = "~T$index~"
}
data class ReifiedTypeParameterByIndex(val index: Int) : TemplatePart() {
override fun toString(): String = "~R$index~"
}
interface TemplatePartIsParameter
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy