Skip to content

Commit 9aba9bc

Browse files
authored
Merge pull request #80 from ForteScarlet/optimze-k2
Refactoring K2 code generation logic
2 parents 6177491 + 374f271 commit 9aba9bc

File tree

87 files changed

+6743
-1049
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

87 files changed

+6743
-1049
lines changed

buildSrc/src/main/kotlin/IProject.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ object IProject : ProjectDetail() {
1111

1212
// Remember the libs.versions.toml!
1313
val ktVersion = "2.1.0"
14-
val pluginVersion = "0.10.2"
14+
val pluginVersion = "0.11.0"
1515

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

compiler/suspend-transform-plugin/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ dependencies {
1717
implementation(kotlin("compiler"))
1818
compileOnly(libs.kotlinx.coroutines.core)
1919
api(libs.kotlinx.serialization.json)
20+
// TODO 改成二进制的,比如 protobuf
2021

2122
testImplementation("junit:junit:4.13.2")
2223
testImplementation(kotlin("stdlib"))

compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/SuspendTransformConfiguration.kt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,14 @@ package love.forte.plugin.suspendtrans
22

33
import kotlinx.serialization.Serializable
44

5+
// TODO 序列化改成二进制的,比如 protobuf,
6+
// 然后使用base64或hash进行传递,避免谜之转义
7+
58
@Serializable
69
data class FunctionInfo(
710
var packageName: String,
8-
var className: String?,
11+
@Deprecated("Top-Level function supported only")
12+
var className: String? = null,
913
var functionName: String,
1014
)
1115

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

169176
open fun clear() {

compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/SuspendTransformUserData.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,11 @@ data class SuspendTransformUserDataFir(
147147
val transformer: Transformer
148148
)
149149

150+
data class SuspendTransformBridgeFunDataFir(
151+
val asProperty: Boolean,
152+
val transformer: Transformer
153+
)
154+
150155
fun FirNamedFunctionSymbol.asOriginSymbol(
151156
targetMarker: ClassId?,
152157
typeParameters: List<FirTypeParameter>,

0 commit comments

Comments
 (0)