Skip to content

Refactoring K2 code generation logic #80

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Feb 14, 2025
2 changes: 1 addition & 1 deletion buildSrc/src/main/kotlin/IProject.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ object IProject : ProjectDetail() {

// Remember the libs.versions.toml!
val ktVersion = "2.1.0"
val pluginVersion = "0.10.2"
val pluginVersion = "0.11.0"

override val version: String = "$ktVersion-$pluginVersion"

Expand Down
1 change: 1 addition & 0 deletions compiler/suspend-transform-plugin/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ dependencies {
implementation(kotlin("compiler"))
compileOnly(libs.kotlinx.coroutines.core)
api(libs.kotlinx.serialization.json)
// TODO 改成二进制的,比如 protobuf

testImplementation("junit:junit:4.13.2")
testImplementation(kotlin("stdlib"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@ package love.forte.plugin.suspendtrans

import kotlinx.serialization.Serializable

// TODO 序列化改成二进制的,比如 protobuf,
// 然后使用base64或hash进行传递,避免谜之转义

@Serializable
data class FunctionInfo(
var packageName: String,
var className: String?,
@Deprecated("Top-Level function supported only")
var className: String? = null,
var functionName: String,
)

Expand Down Expand Up @@ -162,8 +166,11 @@ open class SuspendTransformConfiguration {
/**
* 在 K2 中,用于使 IR 的合成函数可以定位到 FIR 中原始函数的辅助注解。
*
* 昙花一现,在 `*-0.11.0` 之后不再需要此类过渡用注解。
*
* @since *-0.10.0
*/
@Deprecated("Unused after *-0.11.0")
open var targetMarker: ClassInfo? = targetMarkerClassInfo

open fun clear() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,11 @@ data class SuspendTransformUserDataFir(
val transformer: Transformer
)

data class SuspendTransformBridgeFunDataFir(
val asProperty: Boolean,
val transformer: Transformer
)

fun FirNamedFunctionSymbol.asOriginSymbol(
targetMarker: ClassId?,
typeParameters: List<FirTypeParameter>,
Expand Down
Loading