From 395b8039b72ec7301c49c2a2273ecb1480cabd09 Mon Sep 17 00:00:00 2001 From: ForteScarlet Date: Sat, 20 Jan 2024 03:24:10 +0800 Subject: [PATCH 1/8] =?UTF-8?q?K2=E6=95=B4=E4=B8=8D=E4=BC=9A=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- buildSrc/build.gradle.kts | 2 +- buildSrc/src/main/kotlin/IProject.kt | 3 +- .../SuspendTransformFirExtensionRegistrar.kt | 15 +++++ .../fir/SuspendTransformFirTransformer.kt | 54 ++++++++++++++++++ .../SuspendTransformIrGenerationExtension.kt | 2 +- .../ir/SuspendTransformTransformer.kt | 55 +++---------------- .../utils/AnnotationDescriptorUtils.kt | 2 + .../suspendtrans/utils/IrFunctionUtils.kt | 6 +- gradle/libs.versions.toml | 4 +- .../build.gradle.kts | 2 +- samples/sample-js/build.gradle.kts | 5 +- samples/sample-jvm/build.gradle.kts | 23 ++++---- .../suspendtrans/sample/ForteScarlet.kt | 6 ++ 13 files changed, 110 insertions(+), 69 deletions(-) create mode 100644 compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirExtensionRegistrar.kt create mode 100644 compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index f906154..74201a1 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -8,7 +8,7 @@ repositories { gradlePluginPortal() } -val kotlinVersion = "1.9.21" +val kotlinVersion = "2.0.0-Beta3" val dokkaPluginVersion = "1.9.10" val gradleCommon = "0.2.0" val nexusPublishPlugin = "1.3.0" diff --git a/buildSrc/src/main/kotlin/IProject.kt b/buildSrc/src/main/kotlin/IProject.kt index 0e24e4f..8d37063 100644 --- a/buildSrc/src/main/kotlin/IProject.kt +++ b/buildSrc/src/main/kotlin/IProject.kt @@ -1,5 +1,6 @@ import love.forte.gradle.common.core.project.ProjectDetail import love.forte.gradle.common.core.project.Version +import love.forte.gradle.common.core.project.minus import love.forte.gradle.common.core.project.version object IProject : ProjectDetail() { @@ -8,7 +9,7 @@ object IProject : ProjectDetail() { const val DESCRIPTION = "Generate platform-compatible functions for Kotlin suspend functions" const val HOMEPAGE = "https://github.com/ForteScarlet/kotlin-suspend-transform-compiler-plugin" - override val version: Version = version(0, 6, 0) + override val version: Version = version(0, 7, 0) - version("dev1") override val homepage: String get() = HOMEPAGE diff --git a/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirExtensionRegistrar.kt b/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirExtensionRegistrar.kt new file mode 100644 index 0000000..88342b7 --- /dev/null +++ b/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirExtensionRegistrar.kt @@ -0,0 +1,15 @@ +package love.forte.plugin.suspendtrans.fir + +import org.jetbrains.kotlin.fir.extensions.FirExtensionRegistrar + + +/** + * + * @author ForteScarlet + */ +class SuspendTransformFirExtensionRegistrar : FirExtensionRegistrar() { + override fun ExtensionRegistrarContext.configurePlugin() { + + TODO("Not yet implemented") + } +} diff --git a/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt b/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt new file mode 100644 index 0000000..92b714e --- /dev/null +++ b/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt @@ -0,0 +1,54 @@ +package love.forte.plugin.suspendtrans.fir + +import org.jetbrains.kotlin.fir.FirSession +import org.jetbrains.kotlin.fir.caches.FirCache +import org.jetbrains.kotlin.fir.caches.firCachesFactory +import org.jetbrains.kotlin.fir.extensions.FirDeclarationGenerationExtension +import org.jetbrains.kotlin.fir.extensions.MemberGenerationContext +import org.jetbrains.kotlin.fir.java.declarations.FirJavaMethod +import org.jetbrains.kotlin.fir.scopes.impl.FirClassDeclaredMemberScope +import org.jetbrains.kotlin.fir.symbols.impl.FirClassSymbol +import org.jetbrains.kotlin.fir.symbols.impl.FirNamedFunctionSymbol +import org.jetbrains.kotlin.name.CallableId +import org.jetbrains.kotlin.name.Name + + +/** + * + * @author ForteScarlet + */ +class SuspendTransformFirTransformer(private val _session: FirSession) : + FirDeclarationGenerationExtension(_session) { + + + private val cache : FirCache, FirClassDeclaredMemberScope?>, Map?, Nothing?> = +// session.firCachesFactory.createCache(uncurry(::createGetters)) + session.firCachesFactory.createCache { (symbol, declaredScope), context -> + createGetters(symbol, declaredScope) + TODO() + } + + + override fun getTopLevelCallableIds(): Set { + return super.getTopLevelCallableIds() + } + + override fun getCallableNamesForClass(classSymbol: FirClassSymbol<*>, context: MemberGenerationContext): Set { + return super.getCallableNamesForClass(classSymbol, context) + } + + override fun generateFunctions( + callableId: CallableId, + context: MemberGenerationContext? + ): List { + return super.generateFunctions(callableId, context) + } + + + private fun createGetters(classSymbol: FirClassSymbol<*>, declaredScope: FirClassDeclaredMemberScope?): Map? { + + TODO() + } +} + +internal inline fun uncurry(crossinline f: (A, B) -> C): (Pair) -> C = { (a, b) -> f(a, b) } diff --git a/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/ir/SuspendTransformIrGenerationExtension.kt b/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/ir/SuspendTransformIrGenerationExtension.kt index 7b259b6..afdd84b 100644 --- a/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/ir/SuspendTransformIrGenerationExtension.kt +++ b/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/ir/SuspendTransformIrGenerationExtension.kt @@ -16,4 +16,4 @@ open class SuspendTransformIrGenerationExtension(private val configuration: Susp override fun generate(moduleFragment: IrModuleFragment, pluginContext: IrPluginContext) { moduleFragment.transformChildrenVoid(SuspendTransformTransformer(configuration, pluginContext)) } -} \ No newline at end of file +} diff --git a/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/ir/SuspendTransformTransformer.kt b/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/ir/SuspendTransformTransformer.kt index 2d4f5c1..73b2c6f 100644 --- a/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/ir/SuspendTransformTransformer.kt +++ b/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/ir/SuspendTransformTransformer.kt @@ -21,6 +21,7 @@ import org.jetbrains.kotlin.ir.expressions.IrTypeOperator import org.jetbrains.kotlin.ir.expressions.impl.IrFunctionExpressionImpl import org.jetbrains.kotlin.ir.expressions.impl.IrTypeOperatorCallImpl import org.jetbrains.kotlin.ir.symbols.IrSimpleFunctionSymbol +import org.jetbrains.kotlin.ir.symbols.UnsafeDuringIrConstructionAPI import org.jetbrains.kotlin.ir.types.* import org.jetbrains.kotlin.ir.util.isAnnotationWithEqualFqName import org.jetbrains.kotlin.ir.util.primaryConstructor @@ -35,49 +36,6 @@ class SuspendTransformTransformer( private val configuration: SuspendTransformConfiguration, private val pluginContext: IrPluginContext, ) : IrElementTransformerVoidWithContext() { -// private inline val isJvm: Boolean get() = pluginContext.platform?.isJvm() == true -// private inline val isJs: Boolean get() = pluginContext.platform?.isJs() == true - - // private val generatedAnnotation = pluginContext.referenceClass(generatedAnnotationName)!! -// private val jvmRunBlockingFunctionName = configuration.jvm.jvmBlockingFunctionName -// private val jvmRunAsyncFunctionName = configuration.jvm.jvmAsyncFunctionName - -// private val jvmRunBlockingCallableId: CallableId = jvmRunBlockingFunctionName?.callableId -// ?: configuration.jvm.jvmBlockingFunctionInfo.let { blocking -> -// CallableId(blocking.packageName.fqn, blocking.className?.fqn, Name.identifier(blocking.functionName)) -// } -// private val jvmRunAsyncCallableId: CallableId = jvmRunAsyncFunctionName?.callableId -// ?: configuration.jvm.jvmAsyncFunctionInfo.let { async -> -// CallableId(async.packageName.fqn, async.className?.fqn, Name.identifier(async.functionName)) -// } -// -// private val jsRunAsyncFunctionName = configuration.js.jsPromiseFunctionName -// private val jsRunAsyncCallableId = jsRunAsyncFunctionName?.callableId -// ?: configuration.js.jsPromiseFunctionInfo.let { promise -> -// CallableId(promise.packageName.fqn, promise.className?.fqn, Name.identifier(promise.functionName)) -// } -// -// private val jvmOriginIncludeAnnotations = -// configuration.jvm.originFunctionIncludeAnnotations?.toList() ?: emptyList() -// private val jsOriginIncludeAnnotations = configuration.js.originFunctionIncludeAnnotations.toList() -// -// private val jvmRunBlockingFunctionOrNull = -//// pluginContext.referenceFunctions(jvmRunBlockingFunctionName.fqn).singleOrNull() -// pluginContext.referenceFunctions(jvmRunBlockingCallableId).firstOrNull() -// -// private val jvmRunBlockingFunction -// get() = jvmRunBlockingFunctionOrNull -// ?: error("jvmRunBlockingFunction ($jvmRunBlockingFunctionName) unsupported.") -// -// private val jvmRunAsyncFunctionOrNull = pluginContext.referenceFunctions(jvmRunAsyncCallableId).firstOrNull() -// -// private val jvmRunAsyncFunction -// get() = jvmRunAsyncFunctionOrNull ?: error("jvmRunAsyncFunction ($jvmRunAsyncFunctionName) unsupported.") -// -// private val jsRunAsyncFunctionOrNull = pluginContext.referenceFunctions(jsRunAsyncCallableId).firstOrNull() -// -// private val jsRunAsyncFunction -// get() = jsRunAsyncFunctionOrNull ?: error("jsRunAsyncFunction ($jsRunAsyncFunctionName) unsupported.") @OptIn(ObsoleteDescriptorBasedAPI::class) override fun visitFunctionNew(declaration: IrFunction): IrStatement { @@ -131,7 +89,7 @@ class SuspendTransformTransformer( } } - @OptIn(ObsoleteDescriptorBasedAPI::class) + @OptIn(UnsafeDuringIrConstructionAPI::class, ObsoleteDescriptorBasedAPI::class) private fun resolveFunctionBody( function: IrFunction, originFunctionDescriptor: SimpleFunctionDescriptor, @@ -139,6 +97,7 @@ class SuspendTransformTransformer( ): IrFunction? { val parent = function.parent if (parent is IrDeclarationContainer) { +// parent.findDeclaration<> { } val originFunctions = parent.declarations.filterIsInstance() .filter { f -> f.descriptor == originFunctionDescriptor } @@ -146,7 +105,7 @@ class SuspendTransformTransformer( // maybe override function /* interface A { - @JvmBlocking suspend fun a(): Int + @JvmBlocking suspend fun a(): Int } interface B : A { @@ -165,7 +124,6 @@ class SuspendTransformTransformer( val originFunction = originFunctions.first() function.body = null -// function.body = generateTransformBodyForFunction( function.body = generateTransformBodyForFunctionLambda( pluginContext, function, @@ -179,6 +137,7 @@ class SuspendTransformTransformer( } +@OptIn(UnsafeDuringIrConstructionAPI::class) private fun generateTransformBodyForFunction( context: IrPluginContext, function: IrFunction, @@ -230,6 +189,7 @@ private fun generateTransformBodyForFunction( * new * */ +@OptIn(UnsafeDuringIrConstructionAPI::class) private fun generateTransformBodyForFunctionLambda( context: IrPluginContext, function: IrFunction, @@ -245,8 +205,7 @@ private fun generateTransformBodyForFunctionLambda( return context.createIrBuilder(function.symbol).irBlockBody { val suspendLambdaFunc = context.createSuspendLambdaFunctionWithCoroutineScope( originFunction = originFunction, - function = function, - this + function = function ) val lambdaType = context.symbols.suspendFunctionN(0).typeWith(suspendLambdaFunc.returnType) diff --git a/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/utils/AnnotationDescriptorUtils.kt b/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/utils/AnnotationDescriptorUtils.kt index a0154d9..f24202e 100644 --- a/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/utils/AnnotationDescriptorUtils.kt +++ b/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/utils/AnnotationDescriptorUtils.kt @@ -11,6 +11,7 @@ import org.jetbrains.kotlin.ir.builders.IrBuilderWithScope import org.jetbrains.kotlin.ir.builders.irCall import org.jetbrains.kotlin.ir.expressions.IrConstructorCall import org.jetbrains.kotlin.ir.symbols.IrClassSymbol +import org.jetbrains.kotlin.ir.symbols.UnsafeDuringIrConstructionAPI import org.jetbrains.kotlin.ir.util.constructors import org.jetbrains.kotlin.ir.util.irConstructorCall import org.jetbrains.kotlin.resolve.annotations.argumentValue @@ -18,6 +19,7 @@ import org.jetbrains.kotlin.resolve.descriptorUtil.annotationClass import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameUnsafe +@OptIn(UnsafeDuringIrConstructionAPI::class) fun IrBuilderWithScope.irAnnotationConstructor( clazz: IrClassSymbol, ): IrConstructorCall { diff --git a/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/utils/IrFunctionUtils.kt b/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/utils/IrFunctionUtils.kt index 5e6b01e..cdb82e0 100644 --- a/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/utils/IrFunctionUtils.kt +++ b/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/utils/IrFunctionUtils.kt @@ -11,6 +11,7 @@ import org.jetbrains.kotlin.ir.builders.declarations.* import org.jetbrains.kotlin.ir.declarations.* import org.jetbrains.kotlin.ir.declarations.impl.IrFactoryImpl import org.jetbrains.kotlin.ir.expressions.impl.IrGetFieldImpl +import org.jetbrains.kotlin.ir.symbols.UnsafeDuringIrConstructionAPI import org.jetbrains.kotlin.ir.types.IrSimpleType import org.jetbrains.kotlin.ir.types.getClass import org.jetbrains.kotlin.ir.types.typeOrNull @@ -52,6 +53,7 @@ fun IrSimpleFunction.asProperty(): IrProperty { * - extends `suspend () -> Unit`. * - takes dispatch and extension receivers as param, followed by normal value params, to the constructor of this object */ +@OptIn(UnsafeDuringIrConstructionAPI::class) fun IrPluginContext.createSuspendLambdaWithCoroutineScope( parent: IrDeclarationParent, lambdaType: IrSimpleType, @@ -142,8 +144,7 @@ fun IrPluginContext.createSuspendLambdaWithCoroutineScope( fun IrPluginContext.createSuspendLambdaFunctionWithCoroutineScope( originFunction: IrFunction, - function: IrFunction, - blockBodyBuilder: IrBlockBodyBuilder + function: IrFunction ): IrSimpleFunction { return irFactory.buildFun { origin = IrDeclarationOrigin.LOCAL_FUNCTION_FOR_LAMBDA @@ -196,5 +197,6 @@ val Name.identifierOrMappedSpecialName: String } +@OptIn(UnsafeDuringIrConstructionAPI::class) val IrDeclarationContainer.functionsSequence: Sequence get() = declarations.asSequence().filterIsInstance() diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 3384963..1c3adea 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,8 +1,8 @@ [versions] -kotlinx-coroutines = "1.7.0" +kotlinx-coroutines = "1.8.0-RC2" kotlinx-serialization = "1.5.0" google-auto-service = "1.0.1" -kotlin = "1.9.21" +kotlin = "2.0.0-Beta3" compose = "1.5.4" compose-compiler = "1.5.6" compose-plugin = "1.6.0-alpha01" diff --git a/runtime/suspend-transform-annotation/build.gradle.kts b/runtime/suspend-transform-annotation/build.gradle.kts index f9009c8..dffb8b0 100644 --- a/runtime/suspend-transform-annotation/build.gradle.kts +++ b/runtime/suspend-transform-annotation/build.gradle.kts @@ -63,7 +63,7 @@ kotlin { // find all compilations given sourceSet belongs to kotlinExtension.targets .all { - targets.findByName(name)?.compilations?.all { + compilations.all { kotlinOptions.freeCompilerArgs += "-Xexpect-actual-classes" } } diff --git a/samples/sample-js/build.gradle.kts b/samples/sample-js/build.gradle.kts index c843ac4..9f30b7f 100644 --- a/samples/sample-js/build.gradle.kts +++ b/samples/sample-js/build.gradle.kts @@ -14,7 +14,7 @@ buildscript { mavenCentral() } dependencies { - classpath("love.forte.plugin.suspend-transform:suspend-transform-plugin-gradle:0.6.0-local-test-1") + classpath("love.forte.plugin.suspend-transform:suspend-transform-plugin-gradle:0.7.0-dev1") } } @@ -44,7 +44,8 @@ kotlin { // val pluginVersion = "0.4.0" // api("love.forte.plugin.suspend-transform:suspend-transform-runtime:$pluginVersion") // api("love.forte.plugin.suspend-transform:suspend-transform-annotation:$pluginVersion") - implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.3") +// implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.3") + api(libs.kotlinx.coroutines.core) } } } diff --git a/samples/sample-jvm/build.gradle.kts b/samples/sample-jvm/build.gradle.kts index b59ebdb..4a4120c 100644 --- a/samples/sample-jvm/build.gradle.kts +++ b/samples/sample-jvm/build.gradle.kts @@ -9,16 +9,16 @@ plugins { } - buildscript { - this@buildscript.repositories { - mavenLocal() - mavenCentral() - } - dependencies { - //this.implementation() - classpath("love.forte.plugin.suspend-transform:suspend-transform-plugin-gradle:0.6.0-local-test-1") - } - } +buildscript { + this@buildscript.repositories { + mavenLocal() + mavenCentral() + } + dependencies { + //this.implementation() + classpath("love.forte.plugin.suspend-transform:suspend-transform-plugin-gradle:0.7.0-dev1") + } +} //withType { @@ -41,7 +41,8 @@ dependencies { // val pluginVersion = "0.4.0" // api("love.forte.plugin.suspend-transform:suspend-transform-runtime:$pluginVersion") // api("love.forte.plugin.suspend-transform:suspend-transform-annotation:$pluginVersion") - api("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.3") +// api("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.") + api(libs.kotlinx.coroutines.core) } extensions.getByType().apply { diff --git a/samples/sample-jvm/src/main/kotlin/love/forte/plugin/suspendtrans/sample/ForteScarlet.kt b/samples/sample-jvm/src/main/kotlin/love/forte/plugin/suspendtrans/sample/ForteScarlet.kt index 3e789a0..7f0bf66 100644 --- a/samples/sample-jvm/src/main/kotlin/love/forte/plugin/suspendtrans/sample/ForteScarlet.kt +++ b/samples/sample-jvm/src/main/kotlin/love/forte/plugin/suspendtrans/sample/ForteScarlet.kt @@ -37,3 +37,9 @@ class ForteScarlet : CoroutineScope, IForteScarlet() { // } } + +//fun main() { +// for (method in ForteScarlet::class.java.declaredMethods) { +// println(method) +// } +//} From 33b31c7b95b7f3c9bc9a91a4d3959f959387c3a8 Mon Sep 17 00:00:00 2001 From: ForteScarlet Date: Thu, 25 Jan 2024 14:52:27 +0800 Subject: [PATCH 2/8] =?UTF-8?q?=E4=B8=80=E5=B0=8F=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- buildSrc/build.gradle.kts | 2 +- buildSrc/settings.gradle.kts | 8 + .../suspend-transform-plugin/build.gradle.kts | 61 +++- .../SuspendTransformComponentRegistrar.kt | 44 +-- .../SuspendTransformFirExtensionRegistrar.kt | 15 - .../fir/SuspendTransformFirTransformer.kt | 54 ---- .../ir/SuspendTransformTransformer.kt | 21 +- .../SuspendTransformFirExtensionRegistrar.kt | 16 + .../k2/fir/SuspendTransformFirTransformer.kt | 305 ++++++++++++++++++ .../k2/fir/SuspendTransformPluginKey.kt | 9 + ...stractAnnotationArgumentVoidDataVisitor.kt | 21 ++ .../utils/AnnotationDescriptorUtils.kt | 42 ++- .../suspendtrans/utils/IrFunctionUtils.kt | 3 - .../plugin/suspendtrans/GenerateTests.kt | 17 + .../runners/AbstractCodeGenTestRunner.kt | 36 +++ .../runners/AbstractTestRunner.kt | 87 +++++ ...spendTransformerEnvironmentConfigurator.kt | 61 ++++ .../src/testData/codegen/asProperty.kt | 21 ++ .../src/testData/codegen/basic.kt | 32 ++ .../testData/codegen}/override.kt | 9 +- .../testData/codegen}/typeAttr.kt | 2 + .../testData/asProperty.kt | 16 - .../testData/basic.kt | 19 -- gradle/libs.versions.toml | 2 +- 24 files changed, 751 insertions(+), 152 deletions(-) create mode 100644 buildSrc/settings.gradle.kts delete mode 100644 compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirExtensionRegistrar.kt delete mode 100644 compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt create mode 100644 compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/k2/fir/SuspendTransformFirExtensionRegistrar.kt create mode 100644 compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/k2/fir/SuspendTransformFirTransformer.kt create mode 100644 compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/k2/fir/SuspendTransformPluginKey.kt create mode 100644 compiler/suspend-transform-plugin/src/test/love/forte/plugin/suspendtrans/GenerateTests.kt create mode 100644 compiler/suspend-transform-plugin/src/test/love/forte/plugin/suspendtrans/runners/AbstractCodeGenTestRunner.kt create mode 100644 compiler/suspend-transform-plugin/src/test/love/forte/plugin/suspendtrans/runners/AbstractTestRunner.kt create mode 100644 compiler/suspend-transform-plugin/src/test/love/forte/plugin/suspendtrans/services/SuspendTransformerEnvironmentConfigurator.kt create mode 100644 compiler/suspend-transform-plugin/src/testData/codegen/asProperty.kt create mode 100644 compiler/suspend-transform-plugin/src/testData/codegen/basic.kt rename compiler/suspend-transform-plugin/{testData => src/testData/codegen}/override.kt (86%) rename compiler/suspend-transform-plugin/{testData => src/testData/codegen}/typeAttr.kt (94%) delete mode 100644 compiler/suspend-transform-plugin/testData/asProperty.kt delete mode 100644 compiler/suspend-transform-plugin/testData/basic.kt diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index 74201a1..18b30af 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -8,7 +8,7 @@ repositories { gradlePluginPortal() } -val kotlinVersion = "2.0.0-Beta3" +val kotlinVersion: String = libs.versions.kotlin.get() val dokkaPluginVersion = "1.9.10" val gradleCommon = "0.2.0" val nexusPublishPlugin = "1.3.0" diff --git a/buildSrc/settings.gradle.kts b/buildSrc/settings.gradle.kts new file mode 100644 index 0000000..d1e1475 --- /dev/null +++ b/buildSrc/settings.gradle.kts @@ -0,0 +1,8 @@ + +dependencyResolutionManagement { + versionCatalogs { + create("libs") { + from(files("../gradle/libs.versions.toml")) + } + } +} diff --git a/compiler/suspend-transform-plugin/build.gradle.kts b/compiler/suspend-transform-plugin/build.gradle.kts index 64292ab..77db33d 100644 --- a/compiler/suspend-transform-plugin/build.gradle.kts +++ b/compiler/suspend-transform-plugin/build.gradle.kts @@ -22,25 +22,33 @@ dependencies { kapt(libs.google.auto.service) compileOnly(libs.google.auto.service.annotations) + testImplementation("junit:junit:4.13.2") testImplementation(kotlin("stdlib")) - testImplementation(kotlin("test-junit")) - testImplementation(kotlin("compiler-embeddable")) - testImplementation(kotlin("reflect")) -// testImplementation("org.jetbrains.kotlin:kotlin-compiler-embeddable") + testImplementation(kotlin("test-junit5")) + testImplementation(kotlin("compiler")) + testImplementation(kotlin("reflect")) + // see https://github.com/Icyrockton/xjson + testImplementation(kotlin("compiler-internal-test-framework")) // compiler plugin test generator / test utils + testRuntimeOnly(kotlin("test")) + testRuntimeOnly(kotlin("script-runtime")) + testRuntimeOnly(kotlin("annotations-jvm")) testImplementation(project(":runtime:suspend-transform-annotation")) testImplementation(project(":runtime:suspend-transform-runtime")) - testImplementation("com.github.tschuchortdev:kotlin-compile-testing:1.4.9") +// testImplementation("com.github.tschuchortdev:kotlin-compile-testing:1.4.9") // testImplementation("org.bitbucket.mstrobel:procyon-compilertools:0.6.0") -// testImplementation("com.bennyhuo.kotlin:kotlin-compile-testing-extensions:1.7.10.2-SNAPSHOT") testImplementation(libs.kotlinx.coroutines.core) - // testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-jdk8:1.6.4") } val compileKotlin: KotlinCompile by tasks -compileKotlin.kotlinOptions.freeCompilerArgs += listOf("-Xjvm-default=all", "-opt-in=kotlin.RequiresOptIn") +compileKotlin.kotlinOptions.freeCompilerArgs += listOf( + "-Xjvm-default=all", + "-opt-in=kotlin.RequiresOptIn", + "-opt-in=org.jetbrains.kotlin.ir.symbols.UnsafeDuringIrConstructionAPI", +) + repositories { maven { @@ -62,3 +70,40 @@ buildConfig { tasks.withType { kotlinOptions.jvmTarget = "1.8" } + + +sourceSets { + test{ + kotlin.srcDir("src/test") + kotlin.srcDir("src/test-gen") + java.srcDir("src/test-gen") + } +} + +task("generateTest") { + classpath = sourceSets.test.get().runtimeClasspath + mainClass = "love.forte.plugin.suspendtrans.GenerateTestsKt" +} + +// add following properties for test +tasks.test { + useJUnitPlatform() + doFirst { + setLibraryProperty("org.jetbrains.kotlin.test.kotlin-stdlib", "kotlin-stdlib") + setLibraryProperty("org.jetbrains.kotlin.test.kotlin-stdlib-jdk8", "kotlin-stdlib-jdk8") + setLibraryProperty("org.jetbrains.kotlin.test.kotlin-reflect", "kotlin-reflect") + setLibraryProperty("org.jetbrains.kotlin.test.kotlin-test", "kotlin-test") + setLibraryProperty("org.jetbrains.kotlin.test.kotlin-script-runtime", "kotlin-script-runtime") + setLibraryProperty("org.jetbrains.kotlin.test.kotlin-annotations-jvm", "kotlin-annotations-jvm") + } +} + +fun Test.setLibraryProperty(propName: String, jarName: String) { + val path = project.configurations + .testRuntimeClasspath.get() + .files + .find { """$jarName-\d.*jar""".toRegex().matches(it.name) } + ?.absolutePath + ?: return + systemProperty(propName, path) +} diff --git a/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/SuspendTransformComponentRegistrar.kt b/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/SuspendTransformComponentRegistrar.kt index 05f9066..c75c6b3 100644 --- a/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/SuspendTransformComponentRegistrar.kt +++ b/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/SuspendTransformComponentRegistrar.kt @@ -2,11 +2,13 @@ package love.forte.plugin.suspendtrans import com.google.auto.service.AutoService import love.forte.plugin.suspendtrans.ir.SuspendTransformIrGenerationExtension +import love.forte.plugin.suspendtrans.k2.fir.SuspendTransformFirExtensionRegistrar import love.forte.plugin.suspendtrans.symbol.SuspendTransformSyntheticResolveExtension import org.jetbrains.kotlin.backend.common.extensions.IrGenerationExtension import org.jetbrains.kotlin.compiler.plugin.CompilerPluginRegistrar import org.jetbrains.kotlin.compiler.plugin.ExperimentalCompilerApi import org.jetbrains.kotlin.config.CompilerConfiguration +import org.jetbrains.kotlin.fir.extensions.FirExtensionRegistrarAdapter import org.jetbrains.kotlin.resolve.extensions.SyntheticResolveExtension @OptIn(ExperimentalCompilerApi::class) @@ -19,32 +21,34 @@ class SuspendTransformComponentRegistrar : CompilerPluginRegistrar() { get() = true override fun ExtensionStorage.registerExtensions(configuration: CompilerConfiguration) { - val suspendTransformConfiguration =/* defaultConfiguration ?: */ - configuration.resolveToSuspendTransformConfiguration() + register(this, configuration) + } - val suspendTransformSyntheticResolveExtension = - SuspendTransformSyntheticResolveExtension(suspendTransformConfiguration) - val suspendTransformIrGenerationExtension = SuspendTransformIrGenerationExtension(suspendTransformConfiguration) + companion object { + fun register(storage: ExtensionStorage, configuration: CompilerConfiguration) { + val suspendTransformConfiguration =/* defaultConfiguration ?: */ + configuration.resolveToSuspendTransformConfiguration() - SyntheticResolveExtension.registerExtension(suspendTransformSyntheticResolveExtension) - IrGenerationExtension.registerExtension(suspendTransformIrGenerationExtension) - } + register(storage, configuration) + } + fun register(storage: ExtensionStorage, configuration: SuspendTransformConfiguration) { + val suspendTransformSyntheticResolveExtension = + SuspendTransformSyntheticResolveExtension(configuration) + val suspendTransformFirExtensionRegistrar = + SuspendTransformFirExtensionRegistrar(configuration) + val suspendTransformIrGenerationExtension = + SuspendTransformIrGenerationExtension(configuration) -// override fun registerProjectComponents( -// project: MockProject, -// configuration: CompilerConfiguration, -// ) { -// -// val suspendTransformConfiguration =/* defaultConfiguration ?: */configuration.resolveToSuspendTransformConfiguration() -// -// if (suspendTransformConfiguration.enabled) { -// SyntheticResolveExtension.registerExtension(project, SuspendTransformSyntheticResolveExtension(suspendTransformConfiguration)) -// IrGenerationExtension.registerExtension(project, SuspendTransformIrGenerationExtension(suspendTransformConfiguration)) -// } -// } + with(storage) { + SyntheticResolveExtension.registerExtension(suspendTransformSyntheticResolveExtension) + FirExtensionRegistrarAdapter.registerExtension(suspendTransformFirExtensionRegistrar) + IrGenerationExtension.registerExtension(suspendTransformIrGenerationExtension) + } + } + } } diff --git a/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirExtensionRegistrar.kt b/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirExtensionRegistrar.kt deleted file mode 100644 index 88342b7..0000000 --- a/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirExtensionRegistrar.kt +++ /dev/null @@ -1,15 +0,0 @@ -package love.forte.plugin.suspendtrans.fir - -import org.jetbrains.kotlin.fir.extensions.FirExtensionRegistrar - - -/** - * - * @author ForteScarlet - */ -class SuspendTransformFirExtensionRegistrar : FirExtensionRegistrar() { - override fun ExtensionRegistrarContext.configurePlugin() { - - TODO("Not yet implemented") - } -} diff --git a/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt b/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt deleted file mode 100644 index 92b714e..0000000 --- a/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt +++ /dev/null @@ -1,54 +0,0 @@ -package love.forte.plugin.suspendtrans.fir - -import org.jetbrains.kotlin.fir.FirSession -import org.jetbrains.kotlin.fir.caches.FirCache -import org.jetbrains.kotlin.fir.caches.firCachesFactory -import org.jetbrains.kotlin.fir.extensions.FirDeclarationGenerationExtension -import org.jetbrains.kotlin.fir.extensions.MemberGenerationContext -import org.jetbrains.kotlin.fir.java.declarations.FirJavaMethod -import org.jetbrains.kotlin.fir.scopes.impl.FirClassDeclaredMemberScope -import org.jetbrains.kotlin.fir.symbols.impl.FirClassSymbol -import org.jetbrains.kotlin.fir.symbols.impl.FirNamedFunctionSymbol -import org.jetbrains.kotlin.name.CallableId -import org.jetbrains.kotlin.name.Name - - -/** - * - * @author ForteScarlet - */ -class SuspendTransformFirTransformer(private val _session: FirSession) : - FirDeclarationGenerationExtension(_session) { - - - private val cache : FirCache, FirClassDeclaredMemberScope?>, Map?, Nothing?> = -// session.firCachesFactory.createCache(uncurry(::createGetters)) - session.firCachesFactory.createCache { (symbol, declaredScope), context -> - createGetters(symbol, declaredScope) - TODO() - } - - - override fun getTopLevelCallableIds(): Set { - return super.getTopLevelCallableIds() - } - - override fun getCallableNamesForClass(classSymbol: FirClassSymbol<*>, context: MemberGenerationContext): Set { - return super.getCallableNamesForClass(classSymbol, context) - } - - override fun generateFunctions( - callableId: CallableId, - context: MemberGenerationContext? - ): List { - return super.generateFunctions(callableId, context) - } - - - private fun createGetters(classSymbol: FirClassSymbol<*>, declaredScope: FirClassDeclaredMemberScope?): Map? { - - TODO() - } -} - -internal inline fun uncurry(crossinline f: (A, B) -> C): (Pair) -> C = { (a, b) -> f(a, b) } diff --git a/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/ir/SuspendTransformTransformer.kt b/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/ir/SuspendTransformTransformer.kt index 73b2c6f..26982e1 100644 --- a/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/ir/SuspendTransformTransformer.kt +++ b/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/ir/SuspendTransformTransformer.kt @@ -21,7 +21,6 @@ import org.jetbrains.kotlin.ir.expressions.IrTypeOperator import org.jetbrains.kotlin.ir.expressions.impl.IrFunctionExpressionImpl import org.jetbrains.kotlin.ir.expressions.impl.IrTypeOperatorCallImpl import org.jetbrains.kotlin.ir.symbols.IrSimpleFunctionSymbol -import org.jetbrains.kotlin.ir.symbols.UnsafeDuringIrConstructionAPI import org.jetbrains.kotlin.ir.types.* import org.jetbrains.kotlin.ir.util.isAnnotationWithEqualFqName import org.jetbrains.kotlin.ir.util.primaryConstructor @@ -89,13 +88,15 @@ class SuspendTransformTransformer( } } - @OptIn(UnsafeDuringIrConstructionAPI::class, ObsoleteDescriptorBasedAPI::class) + @OptIn(ObsoleteDescriptorBasedAPI::class) private fun resolveFunctionBody( function: IrFunction, originFunctionDescriptor: SimpleFunctionDescriptor, transformTargetFunctionCall: IrSimpleFunctionSymbol, ): IrFunction? { val parent = function.parent + println("!!!resolveFunctionBody.function: $function") + println("!!!resolveFunctionBody.function.parent: ${function.parent}") if (parent is IrDeclarationContainer) { // parent.findDeclaration<> { } val originFunctions = parent.declarations.filterIsInstance() @@ -132,12 +133,14 @@ class SuspendTransformTransformer( ) return originFunction } + + + return null } } -@OptIn(UnsafeDuringIrConstructionAPI::class) private fun generateTransformBodyForFunction( context: IrPluginContext, function: IrFunction, @@ -189,7 +192,6 @@ private fun generateTransformBodyForFunction( * new * */ -@OptIn(UnsafeDuringIrConstructionAPI::class) private fun generateTransformBodyForFunctionLambda( context: IrPluginContext, function: IrFunction, @@ -211,7 +213,16 @@ private fun generateTransformBodyForFunctionLambda( val lambdaType = context.symbols.suspendFunctionN(0).typeWith(suspendLambdaFunc.returnType) +irReturn(irCall(transformTargetFunctionCall).apply { - putValueArgument(0, IrFunctionExpressionImpl(UNDEFINED_OFFSET, UNDEFINED_OFFSET, lambdaType, suspendLambdaFunc, IrStatementOrigin.LAMBDA)) + putValueArgument( + 0, + IrFunctionExpressionImpl( + UNDEFINED_OFFSET, + UNDEFINED_OFFSET, + lambdaType, + suspendLambdaFunc, + IrStatementOrigin.LAMBDA + ) + ) // argument: 1, if is CoroutineScope, and this is CoroutineScope. val owner = transformTargetFunctionCall.owner diff --git a/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/k2/fir/SuspendTransformFirExtensionRegistrar.kt b/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/k2/fir/SuspendTransformFirExtensionRegistrar.kt new file mode 100644 index 0000000..0861b02 --- /dev/null +++ b/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/k2/fir/SuspendTransformFirExtensionRegistrar.kt @@ -0,0 +1,16 @@ +package love.forte.plugin.suspendtrans.k2.fir + +import love.forte.plugin.suspendtrans.SuspendTransformConfiguration +import org.jetbrains.kotlin.fir.extensions.FirDeclarationGenerationExtension +import org.jetbrains.kotlin.fir.extensions.FirExtensionRegistrar + + +/** + * + * @author ForteScarlet + */ +class SuspendTransformFirExtensionRegistrar(private val suspendTransformConfiguration: SuspendTransformConfiguration) : FirExtensionRegistrar() { + override fun ExtensionRegistrarContext.configurePlugin() { + FirDeclarationGenerationExtension.Factory { session -> SuspendTransformFirTransformer(session, suspendTransformConfiguration) }.unaryPlus() + } +} diff --git a/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/k2/fir/SuspendTransformFirTransformer.kt b/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/k2/fir/SuspendTransformFirTransformer.kt new file mode 100644 index 0000000..b6723fc --- /dev/null +++ b/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/k2/fir/SuspendTransformFirTransformer.kt @@ -0,0 +1,305 @@ +package love.forte.plugin.suspendtrans.k2.fir + +import love.forte.plugin.suspendtrans.MarkAnnotation +import love.forte.plugin.suspendtrans.SuspendTransformConfiguration +import love.forte.plugin.suspendtrans.TargetPlatform +import love.forte.plugin.suspendtrans.fqn +import love.forte.plugin.suspendtrans.utils.TransformAnnotationData +import org.jetbrains.kotlin.descriptors.Modality +import org.jetbrains.kotlin.fir.FirSession +import org.jetbrains.kotlin.fir.caches.FirCache +import org.jetbrains.kotlin.fir.caches.firCachesFactory +import org.jetbrains.kotlin.fir.caches.getValue +import org.jetbrains.kotlin.fir.copy +import org.jetbrains.kotlin.fir.declarations.builder.buildProperty +import org.jetbrains.kotlin.fir.declarations.builder.buildPropertyAccessor +import org.jetbrains.kotlin.fir.declarations.builder.buildSimpleFunctionCopy +import org.jetbrains.kotlin.fir.declarations.getAnnotationsByClassId +import org.jetbrains.kotlin.fir.declarations.origin +import org.jetbrains.kotlin.fir.declarations.resolvePhase +import org.jetbrains.kotlin.fir.declarations.utils.isSuspend +import org.jetbrains.kotlin.fir.extensions.FirDeclarationGenerationExtension +import org.jetbrains.kotlin.fir.extensions.FirDeclarationPredicateRegistrar +import org.jetbrains.kotlin.fir.extensions.MemberGenerationContext +import org.jetbrains.kotlin.fir.extensions.predicate.DeclarationPredicate +import org.jetbrains.kotlin.fir.resolve.fqName +import org.jetbrains.kotlin.fir.scopes.impl.FirClassDeclaredMemberScope +import org.jetbrains.kotlin.fir.scopes.processAllFunctions +import org.jetbrains.kotlin.fir.symbols.SymbolInternals +import org.jetbrains.kotlin.fir.symbols.impl.FirClassSymbol +import org.jetbrains.kotlin.fir.symbols.impl.FirNamedFunctionSymbol +import org.jetbrains.kotlin.fir.symbols.impl.FirPropertyAccessorSymbol +import org.jetbrains.kotlin.fir.symbols.impl.FirPropertySymbol +import org.jetbrains.kotlin.name.CallableId +import org.jetbrains.kotlin.name.ClassId +import org.jetbrains.kotlin.name.FqName +import org.jetbrains.kotlin.name.Name +import org.jetbrains.kotlin.platform.isCommon +import org.jetbrains.kotlin.platform.isJs +import org.jetbrains.kotlin.platform.isWasm +import org.jetbrains.kotlin.platform.jvm.isJvm +import org.jetbrains.kotlin.platform.konan.isNative +import java.util.concurrent.ConcurrentHashMap + + +/** + * + * @author ForteScarlet + */ +class SuspendTransformFirTransformer( + session: FirSession, + private val suspendTransformConfiguration: SuspendTransformConfiguration +) : FirDeclarationGenerationExtension(session) { + + // private val cache: FirCache, FirClassDeclaredMemberScope?>, Map?, Nothing?> = +// session.firCachesFactory.createCache(uncurry(::createGetters)) +// session.firCachesFactory.createCache { (symbol, declaredScope), context -> +// createTransformers(symbol, declaredScope) +// } + + private data class FunData( + val annotationData: TransformAnnotationData, + ) + + private val cache: FirCache, FirClassDeclaredMemberScope?>, Map>?, Nothing?> = + session.firCachesFactory.createCache { (symbol, scope), c -> + createCache(symbol, scope) + } + + + override fun getCallableNamesForClass(classSymbol: FirClassSymbol<*>, context: MemberGenerationContext): Set { + val names = mutableSetOf() + + cache.getValue(classSymbol to context.declaredScope)?.forEach { (_, map) -> + map.values.forEach { names.add(Name.identifier(it.annotationData.functionName)) } + } + + return names + } + + @OptIn(SymbolInternals::class) + override fun generateFunctions( + callableId: CallableId, + context: MemberGenerationContext? + ): List { + val owner = context?.owner ?: return emptyList() + val funcMap = cache.getValue(owner to context.declaredScope)?.get(callableId.callableName) ?: return emptyList() + + val funList = mutableListOf() + + funcMap.forEach { (func, funData) -> + val annotationData = funData.annotationData + if (!annotationData.asProperty) { + // generate + + val originFunc = func.fir + + val newFun = buildSimpleFunctionCopy(originFunc) { + name = callableId.callableName + symbol = FirNamedFunctionSymbol(callableId) + status = originFunc.status.copy( + isSuspend = false, + modality = if (originFunc.status.isOverride) Modality.OPEN else originFunc.status.modality, + ) + origin = SuspendTransformPluginKey.origin + } + + funList.add(newFun.symbol) + } + } + + + return funList + } + + @OptIn(SymbolInternals::class) + override fun generateProperties( + callableId: CallableId, + context: MemberGenerationContext? + ): List { + val owner = context?.owner ?: return emptyList() + val funcMap = cache.getValue(owner to context.declaredScope)?.get(callableId.callableName) ?: return emptyList() + + val propList = mutableListOf() + + funcMap.forEach { (func, funData) -> + val annotationData = funData.annotationData + if (annotationData.asProperty) { + // generate + val original = func.fir + + val p = buildProperty { + name = callableId.callableName + symbol = FirPropertySymbol(callableId) + source = original.source + resolvePhase = original.resolvePhase + moduleData = original.moduleData + origin = original.origin + attributes = original.attributes.copy() + status = original.status.copy( + isSuspend = false, + modality = if (original.status.isOverride) Modality.OPEN else original.status.modality, + ) + returnTypeRef = original.returnTypeRef + deprecationsProvider = original.deprecationsProvider + containerSource = original.containerSource + dispatchReceiverType = original.dispatchReceiverType + contextReceivers.addAll(original.contextReceivers) + annotations.addAll(original.annotations) // TODO + typeParameters.addAll(original.typeParameters) + getter = buildPropertyAccessor { + symbol = FirPropertyAccessorSymbol() + source = original.source + resolvePhase = original.resolvePhase + moduleData = original.moduleData + origin = original.origin + attributes = original.attributes.copy() + status = original.status + returnTypeRef = original.returnTypeRef + deprecationsProvider = original.deprecationsProvider + containerSource = original.containerSource + dispatchReceiverType = original.dispatchReceiverType + contextReceivers.addAll(original.contextReceivers) + valueParameters.addAll(original.valueParameters) + body = original.body + contractDescription = original.contractDescription + annotations.addAll(original.annotations) // TODO + typeParameters.addAll(original.typeParameters) + } + } + + propList.add(p.symbol) + } + } + + return propList + } + + private val annotationPredicates = DeclarationPredicate.create { + var predicate: DeclarationPredicate? = null + for (value in suspendTransformConfiguration.transformers.values) { + for (transformer in value) { + val afq = transformer.markAnnotation.fqName + if (predicate == null) { + predicate = metaAnnotated(setOf(afq), false) + } else { + predicate = predicate or metaAnnotated(setOf(afq), false) + } + } + } + + predicate ?: annotated() + } + + /** + * NB: The predict needs to be *registered* in order to parse the [@XSerializable] type + * otherwise, the annotation remains unresolved + */ + override fun FirDeclarationPredicateRegistrar.registerPredicates() { + + +// val serializable = suspendTransformConfiguration.transformers.values +// .asSequence() +// .flatMap { +// it.map { t -> +// DeclarationPredicate.create { annotated(t.markAnnotation.fqName) } +// } +// } +// .reduce { a, b -> a.or(b) } + +// val serializable = +// LookupPredicate.create { +// val annotationFqNames = suspendTransformConfiguration.transformers.values.flatMapTo(mutableSetOf()) { +// it.map { t -> +// t.markAnnotation.fqName +// } +// } +// +// annotated(annotationFqNames) +// } + + register(annotationPredicates) + } + + private fun createCache( + classSymbol: FirClassSymbol<*>, + declaredScope: FirClassDeclaredMemberScope? + ): Map>? { + if (declaredScope == null) return null + + + fun check(targetPlatform: TargetPlatform): Boolean { + val platform = classSymbol.moduleData.platform + + return when { + platform.isJvm() && targetPlatform == TargetPlatform.JVM -> true + platform.isJs() && targetPlatform == TargetPlatform.JS -> true + platform.isWasm() && targetPlatform == TargetPlatform.WASM -> true + platform.isNative() && targetPlatform == TargetPlatform.NATIVE -> true + platform.isCommon() && targetPlatform == TargetPlatform.COMMON -> true + else -> false + } + } + + val map = ConcurrentHashMap>() + + declaredScope.processAllFunctions { func -> + if (!func.isSuspend) return@processAllFunctions +// if (!func.visibility.isPublicAPI) return@processAllFunctions + + val functionName = func.name.asString() + suspendTransformConfiguration.transformers.asSequence() + .filter { (platform, _) -> check(platform) } + .forEach { (_, transformerList) -> + for (transformer in transformerList) { + val markAnnotation = transformer.markAnnotation + + val anno = func.resolvedAnnotationsWithArguments.getAnnotationsByClassId( + markAnnotation.classId, + session + ).firstOrNull() + ?: classSymbol.resolvedAnnotationsWithArguments.getAnnotationsByClassId( + markAnnotation.classId, + session + ).firstOrNull() + ?: continue + + println("!!${functionName}.anno: ${anno.fqName(session)}") + println("!!${functionName}.anno.mapping: ${anno.argumentMapping.mapping}") + println() + + // TODO 读不到注解的参数? + + val annoData = TransformAnnotationData.of( + firAnnotation = anno, + annotationBaseNamePropertyName = markAnnotation.baseNameProperty, + annotationSuffixPropertyName = markAnnotation.suffixProperty, + annotationAsPropertyPropertyName = markAnnotation.asPropertyProperty, + defaultBaseName = functionName, + defaultSuffix = markAnnotation.defaultSuffix, + defaultAsProperty = markAnnotation.defaultAsProperty, + ) + + println("AnnoData: $annoData") + + map.computeIfAbsent(Name.identifier(annoData.functionName)) { ConcurrentHashMap() }[func] = + FunData(annoData) + } + } + } + + return map + } +} + + +private val MarkAnnotation.classId: ClassId + get() { + return ClassId(classInfo.packageName.fqn, classInfo.className.fqn, classInfo.local) + } + + +private val MarkAnnotation.fqName: FqName + get() { + return FqName(classInfo.packageName + "." + classInfo.className) + } diff --git a/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/k2/fir/SuspendTransformPluginKey.kt b/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/k2/fir/SuspendTransformPluginKey.kt new file mode 100644 index 0000000..44ff86f --- /dev/null +++ b/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/k2/fir/SuspendTransformPluginKey.kt @@ -0,0 +1,9 @@ +package love.forte.plugin.suspendtrans.k2.fir + +import org.jetbrains.kotlin.GeneratedDeclarationKey + +object SuspendTransformPluginKey : GeneratedDeclarationKey() { + override fun toString(): String { + return "SuspendTransform GeneratedDeclarationKey" + } +} diff --git a/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/utils/AbstractAnnotationArgumentVoidDataVisitor.kt b/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/utils/AbstractAnnotationArgumentVoidDataVisitor.kt index 41c9013..af99a5f 100644 --- a/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/utils/AbstractAnnotationArgumentVoidDataVisitor.kt +++ b/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/utils/AbstractAnnotationArgumentVoidDataVisitor.kt @@ -2,6 +2,8 @@ package love.forte.plugin.suspendtrans.utils import org.jetbrains.kotlin.descriptors.annotations.AnnotationArgumentVisitor import org.jetbrains.kotlin.descriptors.annotations.AnnotationDescriptor +import org.jetbrains.kotlin.fir.FirElement +import org.jetbrains.kotlin.fir.visitors.FirVisitor import org.jetbrains.kotlin.name.ClassId import org.jetbrains.kotlin.name.Name import org.jetbrains.kotlin.resolve.constants.* @@ -88,3 +90,22 @@ abstract class AbstractNullableAnnotationArgumentVoidDataVisitor : AbstractAn } } +abstract class AbstractFirAnnotationArgumentVoidDataVisitor : FirVisitor() { + + companion object { + val nullableString = object : AbstractFirAnnotationArgumentVoidDataVisitor() { + override fun visitElement(element: FirElement, data: Nothing?): String? { + println("Visited element: $element") + return null + } + } + val nullableBoolean = object : AbstractFirAnnotationArgumentVoidDataVisitor() { + override fun visitElement(element: FirElement, data: Nothing?): Boolean? { + println("Visited element: $element") + return null + } + } + } + +} + diff --git a/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/utils/AnnotationDescriptorUtils.kt b/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/utils/AnnotationDescriptorUtils.kt index f24202e..e1f13f0 100644 --- a/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/utils/AnnotationDescriptorUtils.kt +++ b/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/utils/AnnotationDescriptorUtils.kt @@ -7,19 +7,19 @@ import love.forte.plugin.suspendtrans.toJvmBlockingAnnotationName import org.jetbrains.kotlin.descriptors.DeclarationDescriptor import org.jetbrains.kotlin.descriptors.FunctionDescriptor import org.jetbrains.kotlin.descriptors.annotations.AnnotationDescriptor +import org.jetbrains.kotlin.fir.expressions.FirAnnotation import org.jetbrains.kotlin.ir.builders.IrBuilderWithScope import org.jetbrains.kotlin.ir.builders.irCall import org.jetbrains.kotlin.ir.expressions.IrConstructorCall import org.jetbrains.kotlin.ir.symbols.IrClassSymbol -import org.jetbrains.kotlin.ir.symbols.UnsafeDuringIrConstructionAPI import org.jetbrains.kotlin.ir.util.constructors import org.jetbrains.kotlin.ir.util.irConstructorCall +import org.jetbrains.kotlin.name.Name import org.jetbrains.kotlin.resolve.annotations.argumentValue import org.jetbrains.kotlin.resolve.descriptorUtil.annotationClass import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameUnsafe -@OptIn(UnsafeDuringIrConstructionAPI::class) fun IrBuilderWithScope.irAnnotationConstructor( clazz: IrClassSymbol, ): IrConstructorCall { @@ -37,7 +37,7 @@ fun Iterable.filterNotCompileAnnotations(): List Unit`. * - takes dispatch and extension receivers as param, followed by normal value params, to the constructor of this object */ -@OptIn(UnsafeDuringIrConstructionAPI::class) fun IrPluginContext.createSuspendLambdaWithCoroutineScope( parent: IrDeclarationParent, lambdaType: IrSimpleType, @@ -197,6 +195,5 @@ val Name.identifierOrMappedSpecialName: String } -@OptIn(UnsafeDuringIrConstructionAPI::class) val IrDeclarationContainer.functionsSequence: Sequence get() = declarations.asSequence().filterIsInstance() diff --git a/compiler/suspend-transform-plugin/src/test/love/forte/plugin/suspendtrans/GenerateTests.kt b/compiler/suspend-transform-plugin/src/test/love/forte/plugin/suspendtrans/GenerateTests.kt new file mode 100644 index 0000000..420ccf7 --- /dev/null +++ b/compiler/suspend-transform-plugin/src/test/love/forte/plugin/suspendtrans/GenerateTests.kt @@ -0,0 +1,17 @@ +package love.forte.plugin.suspendtrans +import love.forte.plugin.suspendtrans.runners.AbstractCodeGenTestRunner +import org.jetbrains.kotlin.generators.generateTestGroupSuiteWithJUnit5 + +private const val PROJECT_ROOT = "compiler/suspend-transform-plugin" + +fun main() { + println("generating test class...") + generateTestGroupSuiteWithJUnit5 { + testGroup(testsRoot = "$PROJECT_ROOT/src/test-gen", testDataRoot = "$PROJECT_ROOT/src/testData") { + testClass { + model(relativeRootPath = "codegen") + } + + } + } +} diff --git a/compiler/suspend-transform-plugin/src/test/love/forte/plugin/suspendtrans/runners/AbstractCodeGenTestRunner.kt b/compiler/suspend-transform-plugin/src/test/love/forte/plugin/suspendtrans/runners/AbstractCodeGenTestRunner.kt new file mode 100644 index 0000000..28748a7 --- /dev/null +++ b/compiler/suspend-transform-plugin/src/test/love/forte/plugin/suspendtrans/runners/AbstractCodeGenTestRunner.kt @@ -0,0 +1,36 @@ +package love.forte.plugin.suspendtrans.runners + +import org.jetbrains.kotlin.test.backend.handlers.AsmLikeInstructionListingHandler +import org.jetbrains.kotlin.test.backend.handlers.BytecodeListingHandler +import org.jetbrains.kotlin.test.backend.handlers.IrTextDumpHandler +import org.jetbrains.kotlin.test.builders.TestConfigurationBuilder +import org.jetbrains.kotlin.test.builders.configureFirHandlersStep +import org.jetbrains.kotlin.test.builders.configureJvmArtifactsHandlersStep +import org.jetbrains.kotlin.test.builders.irHandlersStep +import org.jetbrains.kotlin.test.directives.AsmLikeInstructionListingDirectives.CHECK_ASM_LIKE_INSTRUCTIONS +import org.jetbrains.kotlin.test.frontend.fir.handlers.FirCfgDumpHandler +import org.jetbrains.kotlin.test.frontend.fir.handlers.FirDiagnosticsHandler +import org.jetbrains.kotlin.test.frontend.fir.handlers.FirDumpHandler +import org.jetbrains.kotlin.test.frontend.fir.handlers.FirResolvedTypesVerifier + +abstract class AbstractCodeGenTestRunner : AbstractTestRunner() { + override fun TestConfigurationBuilder.configureHandlers() { + configureFirHandlersStep { + useHandlers( + ::FirDumpHandler, ::FirCfgDumpHandler, ::FirResolvedTypesVerifier, ::FirDiagnosticsHandler, + ) + } + + irHandlersStep { + useHandlers(::IrTextDumpHandler) + } + + configureJvmArtifactsHandlersStep { + useHandlers(::BytecodeListingHandler,::AsmLikeInstructionListingHandler, ) + } + + defaultDirectives { + +CHECK_ASM_LIKE_INSTRUCTIONS + } + } +} diff --git a/compiler/suspend-transform-plugin/src/test/love/forte/plugin/suspendtrans/runners/AbstractTestRunner.kt b/compiler/suspend-transform-plugin/src/test/love/forte/plugin/suspendtrans/runners/AbstractTestRunner.kt new file mode 100644 index 0000000..0fe4d63 --- /dev/null +++ b/compiler/suspend-transform-plugin/src/test/love/forte/plugin/suspendtrans/runners/AbstractTestRunner.kt @@ -0,0 +1,87 @@ +package love.forte.plugin.suspendtrans.runners + +import love.forte.plugin.suspendtrans.services.SuspendTransformerEnvironmentConfigurator +import org.jetbrains.kotlin.config.ApiVersion +import org.jetbrains.kotlin.config.LanguageVersion +import org.jetbrains.kotlin.platform.jvm.JvmPlatforms +import org.jetbrains.kotlin.test.FirParser +import org.jetbrains.kotlin.test.TargetBackend +import org.jetbrains.kotlin.test.backend.ir.JvmIrBackendFacade +import org.jetbrains.kotlin.test.builders.TestConfigurationBuilder +import org.jetbrains.kotlin.test.builders.configureFirHandlersStep +import org.jetbrains.kotlin.test.builders.configureJvmArtifactsHandlersStep +import org.jetbrains.kotlin.test.directives.FirDiagnosticsDirectives.FIR_PARSER +import org.jetbrains.kotlin.test.frontend.fir.Fir2IrResultsConverter +import org.jetbrains.kotlin.test.frontend.fir.FirFrontendFacade +import org.jetbrains.kotlin.test.initIdeaConfiguration +import org.jetbrains.kotlin.test.model.ArtifactKinds +import org.jetbrains.kotlin.test.model.DependencyKind +import org.jetbrains.kotlin.test.model.FrontendKinds +import org.jetbrains.kotlin.test.runners.AbstractKotlinCompilerTest +import org.jetbrains.kotlin.test.runners.codegen.commonConfigurationForTest +import org.jetbrains.kotlin.test.services.EnvironmentBasedStandardLibrariesPathProvider +import org.jetbrains.kotlin.test.services.KotlinStandardLibrariesPathProvider +import org.jetbrains.kotlin.test.services.configuration.CommonEnvironmentConfigurator +import org.jetbrains.kotlin.test.services.configuration.JvmEnvironmentConfigurator +import org.junit.jupiter.api.BeforeAll + +abstract class AbstractTestRunner : AbstractKotlinCompilerTest() { + companion object { + @BeforeAll + @JvmStatic + fun setUp() { + initIdeaConfiguration() // set system property to initialize idea service + } + } + + override fun TestConfigurationBuilder.configuration() { + globalDefaults { + frontend = FrontendKinds.FIR + targetBackend = TargetBackend.JVM_IR + targetPlatform = JvmPlatforms.defaultJvmPlatform + artifactKind = ArtifactKinds.Jvm + dependencyKind = DependencyKind.Source + languageSettings { + languageVersion = LanguageVersion.KOTLIN_2_1 + apiVersion = ApiVersion.KOTLIN_2_1 + } +// languageSettings { +// languageVersion = LanguageVersion.KOTLIN_1_9 +// apiVersion = ApiVersion.KOTLIN_1_9 +// } + } + + defaultDirectives { + FIR_PARSER with FirParser.LightTree + } + + commonConfigurationForTest( + FrontendKinds.FIR, + ::FirFrontendFacade, + ::Fir2IrResultsConverter, + ::JvmIrBackendFacade + ) { } + + configureHandlers() + configureFirHandlersStep { + + } + + configureJvmArtifactsHandlersStep { + + } + + useConfigurators( + ::CommonEnvironmentConfigurator, // compiler flags + ::JvmEnvironmentConfigurator, // jdk and kotlin runtime configuration (e.g. FULL_JDK) + ::SuspendTransformerEnvironmentConfigurator, // compiler plugin configuration + ) + + } + + abstract fun TestConfigurationBuilder.configureHandlers() + + override fun createKotlinStandardLibrariesPathProvider(): KotlinStandardLibrariesPathProvider { + return EnvironmentBasedStandardLibrariesPathProvider + } +} diff --git a/compiler/suspend-transform-plugin/src/test/love/forte/plugin/suspendtrans/services/SuspendTransformerEnvironmentConfigurator.kt b/compiler/suspend-transform-plugin/src/test/love/forte/plugin/suspendtrans/services/SuspendTransformerEnvironmentConfigurator.kt new file mode 100644 index 0000000..c69a1e4 --- /dev/null +++ b/compiler/suspend-transform-plugin/src/test/love/forte/plugin/suspendtrans/services/SuspendTransformerEnvironmentConfigurator.kt @@ -0,0 +1,61 @@ +package love.forte.plugin.suspendtrans.services + +import love.forte.plugin.suspendtrans.SuspendTransformComponentRegistrar +import love.forte.plugin.suspendtrans.SuspendTransformConfiguration +import org.jetbrains.kotlin.cli.jvm.config.addJvmClasspathRoot +import org.jetbrains.kotlin.compiler.plugin.CompilerPluginRegistrar +import org.jetbrains.kotlin.compiler.plugin.ExperimentalCompilerApi +import org.jetbrains.kotlin.config.CompilerConfiguration +import org.jetbrains.kotlin.test.model.TestModule +import org.jetbrains.kotlin.test.services.EnvironmentConfigurator +import org.jetbrains.kotlin.test.services.TestServices +import org.jetbrains.kotlin.utils.PathUtil +import java.io.File + +/** + * Inject XJson plugin into test environment + */ +class SuspendTransformerEnvironmentConfigurator(testServices: TestServices) : EnvironmentConfigurator(testServices) { + + @OptIn(ExperimentalCompilerApi::class) + override fun CompilerPluginRegistrar.ExtensionStorage.registerCompilerExtensions( + module: TestModule, + configuration: CompilerConfiguration + ) { + // register plugin + SuspendTransformComponentRegistrar.register(this, SuspendTransformConfiguration().apply { + useDefault() + }) + } + + override fun configureCompilerConfiguration(configuration: CompilerConfiguration, module: TestModule) { + // register runtimes + getRuntimeJarFile("love.forte.plugin.suspendtrans.runtime.RunInSuspendJvmKt")?.let { + configuration.addJvmClasspathRoot( + it + ) + } + getRuntimeJarFile("love.forte.plugin.suspendtrans.annotation.JvmAsync")?.let { + configuration.addJvmClasspathRoot( + it + ) + } + getRuntimeJarFile("love.forte.plugin.suspendtrans.annotation.JvmBlocking")?.let { + configuration.addJvmClasspathRoot( + it + ) + } + } + + private fun getRuntimeJarFile(className: String): File? { + try { + val clazz = Class.forName(className) + return PathUtil.getResourcePathForClass(clazz) + } catch (e: ClassNotFoundException) { + System.err.println("Runtime jar '$className' not found!") +// assert(false) { "Runtime jar '$className' not found!" } + } + return null + } + +} diff --git a/compiler/suspend-transform-plugin/src/testData/codegen/asProperty.kt b/compiler/suspend-transform-plugin/src/testData/codegen/asProperty.kt new file mode 100644 index 0000000..6d359a5 --- /dev/null +++ b/compiler/suspend-transform-plugin/src/testData/codegen/asProperty.kt @@ -0,0 +1,21 @@ +// FIR_DUMP +// DUMP_IR +// SOURCE +// FILE: Main.kt [MainKt#main] + +import kotlinx.coroutines.runBlocking +import love.forte.plugin.suspendtrans.annotation.JvmAsync +import love.forte.plugin.suspendtrans.annotation.JvmBlocking + +annotation class TA(val value: String = "forte") + +class PropFoo { + @love.forte.plugin.suspendtrans.annotation.JvmBlocking(asProperty = true, suffix = "") + @love.forte.plugin.suspendtrans.annotation.JvmAsync(asProperty = true) + @TA(value = "forliy") + suspend fun prop(): String = "" + + @JvmBlocking + @JvmAsync + suspend fun age(): Int = 1 +} diff --git a/compiler/suspend-transform-plugin/src/testData/codegen/basic.kt b/compiler/suspend-transform-plugin/src/testData/codegen/basic.kt new file mode 100644 index 0000000..e44c5ca --- /dev/null +++ b/compiler/suspend-transform-plugin/src/testData/codegen/basic.kt @@ -0,0 +1,32 @@ +// FIR_DUMP +// DUMP_IR +// SOURCE +// FILE: Main.kt [MainKt#main] + +import love.forte.plugin.suspendtrans.annotation.JvmAsync +import love.forte.plugin.suspendtrans.annotation.JvmBlocking +//import kotlinx.coroutines.CoroutineScope +//import kotlin.coroutines.CoroutineContext +//import kotlin.coroutines.EmptyCoroutineContext + +class BasicFoo { + @JvmAsync + suspend fun foo(): String = "" +} + +class BasicBar +// : CoroutineScope +{ + //override val coroutineContext: CoroutineContext = EmptyCoroutineContext + @JvmAsync + suspend fun bar(): String = "" + @JvmAsync + suspend fun bar(i: Int): String = "" +} + +interface InterfaceBar { + @JvmAsync + suspend fun bar(): String + @JvmAsync + suspend fun bar(i: Int): String +} diff --git a/compiler/suspend-transform-plugin/testData/override.kt b/compiler/suspend-transform-plugin/src/testData/codegen/override.kt similarity index 86% rename from compiler/suspend-transform-plugin/testData/override.kt rename to compiler/suspend-transform-plugin/src/testData/codegen/override.kt index a08b5fa..aa0e5b2 100644 --- a/compiler/suspend-transform-plugin/testData/override.kt +++ b/compiler/suspend-transform-plugin/src/testData/codegen/override.kt @@ -1,3 +1,5 @@ +// FIR_DUMP +// DUMP_IR // SOURCE // FILE: Main.kt [MainKt#main] import love.forte.plugin.suspendtrans.annotation.JvmAsync @@ -13,9 +15,7 @@ interface Foo : IFoo { @JvmBlocking @JvmAsync suspend fun run(): Bar - - suspend fun run(name: String): Bar - + suspend fun run(name:String): Tar = Tar() override suspend fun run(n: Int): Bar } @@ -25,6 +25,5 @@ class FooImpl : Foo { override suspend fun run(n: Int): Bar = Tar() } - open class Bar -class Tar : Bar() \ No newline at end of file +class Tar : Bar() diff --git a/compiler/suspend-transform-plugin/testData/typeAttr.kt b/compiler/suspend-transform-plugin/src/testData/codegen/typeAttr.kt similarity index 94% rename from compiler/suspend-transform-plugin/testData/typeAttr.kt rename to compiler/suspend-transform-plugin/src/testData/codegen/typeAttr.kt index dbc80b6..5ef9cf0 100644 --- a/compiler/suspend-transform-plugin/testData/typeAttr.kt +++ b/compiler/suspend-transform-plugin/src/testData/codegen/typeAttr.kt @@ -1,3 +1,5 @@ +// FIR_DUMP +// DUMP_IR // SOURCE // FILE: Main.kt [MainKt#main] import love.forte.plugin.suspendtrans.annotation.JvmAsync diff --git a/compiler/suspend-transform-plugin/testData/asProperty.kt b/compiler/suspend-transform-plugin/testData/asProperty.kt deleted file mode 100644 index 345b691..0000000 --- a/compiler/suspend-transform-plugin/testData/asProperty.kt +++ /dev/null @@ -1,16 +0,0 @@ -// SOURCE -// FILE: Main.kt [MainKt#main] -import kotlinx.coroutines.runBlocking -import love.forte.plugin.suspendtrans.annotation.JvmAsync -import love.forte.plugin.suspendtrans.annotation.JvmBlocking - - -class Foo { - @JvmBlocking(asProperty = true, suffix = "") - @JvmAsync(asProperty = true) - suspend fun name(): String = "" - - @JvmBlocking - @JvmAsync - suspend fun age(): Int = 1 -} diff --git a/compiler/suspend-transform-plugin/testData/basic.kt b/compiler/suspend-transform-plugin/testData/basic.kt deleted file mode 100644 index 39c7e73..0000000 --- a/compiler/suspend-transform-plugin/testData/basic.kt +++ /dev/null @@ -1,19 +0,0 @@ -// SOURCE -// FILE: Main.kt [MainKt#main] -import kotlinx.coroutines.runBlocking -import love.forte.plugin.suspendtrans.annotation.JvmAsync -import love.forte.plugin.suspendtrans.annotation.JvmBlocking -import kotlinx.coroutines.CoroutineScope -import kotlin.coroutines.CoroutineContext -import kotlin.coroutines.EmptyCoroutineContext - -class Foo { - @JvmAsync - suspend fun foo(): String = "" -} - -class Bar : CoroutineScope { - override val coroutineContext: CoroutineContext = EmptyCoroutineContext - @JvmAsync - suspend fun bar(): String = "" -} \ No newline at end of file diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 1c3adea..6bd43cd 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -2,7 +2,7 @@ kotlinx-coroutines = "1.8.0-RC2" kotlinx-serialization = "1.5.0" google-auto-service = "1.0.1" -kotlin = "2.0.0-Beta3" +kotlin = "1.9.21" compose = "1.5.4" compose-compiler = "1.5.6" compose-plugin = "1.6.0-alpha01" From 40812f98d58cb62f7d56882e5c5de9e5dc86db2b Mon Sep 17 00:00:00 2001 From: ForteScarlet Date: Thu, 25 Jan 2024 21:19:17 +0800 Subject: [PATCH 3/8] =?UTF-8?q?=E5=B0=9D=E8=AF=95=E6=94=AF=E6=8C=81=20K2?= =?UTF-8?q?=20=E7=BC=96=E8=AF=91=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../suspend-transform-plugin/build.gradle.kts | 1 + .../forte/plugin/suspendtrans/Constants.kt | 3 + .../SuspendTransformComponentRegistrar.kt | 4 +- .../SuspendTransformConfiguration.kt | 3 +- .../suspendtrans/SuspendTransformUserData.kt | 116 +++ ...uspendTransformCollectionElementChecker.kt | 21 - ...dTransformComponentContainerContributor.kt | 19 - .../SuspendTransformFirExtensionRegistrar.kt | 10 +- .../fir/SuspendTransformFirTransformer.kt | 262 ++++- .../fir/SuspendTransformPluginKey.kt | 10 + .../ir/SuspendTransformTransformer.kt | 127 ++- .../k2/fir/SuspendTransformPluginKey.kt | 9 - ...tractSuspendTransformFunctionDescriptor.kt | 12 +- ...spendTransformSyntheticResolveExtension.kt | 28 +- .../utils/AnnotationDescriptorUtils.kt | 11 +- .../suspendtrans/utils/CopyAnnotationUtils.kt | 19 + .../src/testData/codegen/basic.kt | 20 +- gradle.properties | 2 +- kotlin-js-store/yarn.lock | 903 +++++++++++++++++- samples/sample-wasmJs/build.gradle.kts | 2 +- settings.gradle.kts | 6 +- 21 files changed, 1384 insertions(+), 204 deletions(-) create mode 100644 compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/Constants.kt delete mode 100644 compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/checker/SuspendTransformCollectionElementChecker.kt delete mode 100644 compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/checker/SuspendTransformComponentContainerContributor.kt rename compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/{k2 => }/fir/SuspendTransformFirExtensionRegistrar.kt (64%) rename compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/{k2 => }/fir/SuspendTransformFirTransformer.kt (55%) create mode 100644 compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformPluginKey.kt delete mode 100644 compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/k2/fir/SuspendTransformPluginKey.kt create mode 100644 compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/utils/CopyAnnotationUtils.kt diff --git a/compiler/suspend-transform-plugin/build.gradle.kts b/compiler/suspend-transform-plugin/build.gradle.kts index 77db33d..b903be8 100644 --- a/compiler/suspend-transform-plugin/build.gradle.kts +++ b/compiler/suspend-transform-plugin/build.gradle.kts @@ -11,6 +11,7 @@ plugins { //testWithEmbedded0() + dependencies { compileOnly(kotlin("stdlib")) compileOnly(kotlin("compiler")) diff --git a/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/Constants.kt b/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/Constants.kt new file mode 100644 index 0000000..b100aea --- /dev/null +++ b/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/Constants.kt @@ -0,0 +1,3 @@ +package love.forte.plugin.suspendtrans + +const val PLUGIN_REPORT_ID = "love.forte.plugin.suspendtrans.SuspendTransform" diff --git a/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/SuspendTransformComponentRegistrar.kt b/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/SuspendTransformComponentRegistrar.kt index c75c6b3..88359c4 100644 --- a/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/SuspendTransformComponentRegistrar.kt +++ b/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/SuspendTransformComponentRegistrar.kt @@ -1,8 +1,8 @@ package love.forte.plugin.suspendtrans import com.google.auto.service.AutoService +import love.forte.plugin.suspendtrans.fir.SuspendTransformFirExtensionRegistrar import love.forte.plugin.suspendtrans.ir.SuspendTransformIrGenerationExtension -import love.forte.plugin.suspendtrans.k2.fir.SuspendTransformFirExtensionRegistrar import love.forte.plugin.suspendtrans.symbol.SuspendTransformSyntheticResolveExtension import org.jetbrains.kotlin.backend.common.extensions.IrGenerationExtension import org.jetbrains.kotlin.compiler.plugin.CompilerPluginRegistrar @@ -30,7 +30,7 @@ class SuspendTransformComponentRegistrar : CompilerPluginRegistrar() { val suspendTransformConfiguration =/* defaultConfiguration ?: */ configuration.resolveToSuspendTransformConfiguration() - register(storage, configuration) + register(storage, suspendTransformConfiguration) } fun register(storage: ExtensionStorage, configuration: SuspendTransformConfiguration) { diff --git a/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/SuspendTransformConfiguration.kt b/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/SuspendTransformConfiguration.kt index ca77e8c..db53b85 100644 --- a/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/SuspendTransformConfiguration.kt +++ b/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/SuspendTransformConfiguration.kt @@ -13,7 +13,8 @@ data class FunctionInfo( data class ClassInfo @JvmOverloads constructor( var packageName: String, var className: String, - var local: Boolean = false + var local: Boolean = false, + var nullable: Boolean = false, ) @Serializable diff --git a/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/SuspendTransformUserData.kt b/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/SuspendTransformUserData.kt index 341b1a0..79b3a4b 100644 --- a/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/SuspendTransformUserData.kt +++ b/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/SuspendTransformUserData.kt @@ -2,6 +2,20 @@ package love.forte.plugin.suspendtrans import org.jetbrains.kotlin.descriptors.CallableDescriptor import org.jetbrains.kotlin.descriptors.SimpleFunctionDescriptor +import org.jetbrains.kotlin.fir.declarations.FirTypeParameter +import org.jetbrains.kotlin.fir.declarations.FirValueParameter +import org.jetbrains.kotlin.fir.symbols.impl.FirNamedFunctionSymbol +import org.jetbrains.kotlin.fir.symbols.impl.FirPropertyAccessorSymbol +import org.jetbrains.kotlin.fir.types.classId +import org.jetbrains.kotlin.fir.types.coneTypeOrNull +import org.jetbrains.kotlin.ir.declarations.IrFunction +import org.jetbrains.kotlin.ir.declarations.IrTypeParameter +import org.jetbrains.kotlin.ir.declarations.IrValueParameter +import org.jetbrains.kotlin.ir.types.classFqName +import org.jetbrains.kotlin.ir.util.callableId +import org.jetbrains.kotlin.name.CallableId +import org.jetbrains.kotlin.name.ClassId +import org.jetbrains.kotlin.name.Name object SuspendTransformUserDataKey : CallableDescriptor.UserDataKey @@ -10,3 +24,105 @@ data class SuspendTransformUserData( val asProperty: Boolean, val transformer: Transformer ) + +data class SuspendTransformUserDataFir( + val originSymbol: OriginSymbol, + val asProperty: Boolean, + val transformer: Transformer +) + +fun FirNamedFunctionSymbol.asOriginSymbol( + typeParameters: List, + valueParameters: List, + returnType: ClassId? +): OriginSymbol { + return OriginSymbol( + callableId = this.callableId, + typeParameters = typeParameters.map { it.toTypeParameter() }, + valueParameters = valueParameters.map { it.toValueParameter() }, + returnType + ) +} + +fun FirPropertyAccessorSymbol.asOriginSymbol( + typeParameters: List, + valueParameters: List, + returnType: ClassId? +): OriginSymbol { + println(typeParameters) + return OriginSymbol( + callableId = this.callableId, + typeParameters = typeParameters.map { it.toTypeParameter() }, + valueParameters = valueParameters.map { it.toValueParameter() }, + returnType + ) +} + + +data class OriginSymbol( + val callableId: CallableId, + val typeParameters: List, + val valueParameters: List, + val returnType: ClassId? +) + +data class TypeParameter(val name: Name, val varianceOrdinal: Int, val isReified: Boolean, val bounds: List) + +private fun FirTypeParameter.toTypeParameter(): TypeParameter = + TypeParameter( + name, + variance.ordinal, + isReified, + bounds.map { it.coneTypeOrNull?.classId } + ) + + +data class ValueParameter(val name: Name, val type: ClassId?) + +private fun FirValueParameter.toValueParameter(): ValueParameter = + ValueParameter(name, returnTypeRef.coneTypeOrNull?.type?.classId) + + +fun OriginSymbol.checkSame(declaration: IrFunction): Boolean { + // callableId + if (callableId != declaration.callableId) return false + // return type + if (declaration.returnType.classFqName != returnType?.asSingleFqName()) return false + // typeParameters + val declarationTypeParameters = declaration.typeParameters + if (typeParameters.size != declarationTypeParameters.size) return false + for ((index, typeParameter) in declarationTypeParameters.withIndex()) { + val targetTypeParameter = typeParameters[index] + if (!(typeParameter isSameAs targetTypeParameter)) return false + } + + // valueParameters + val declarationValueParameters = declaration.valueParameters + if (valueParameters.size != declarationValueParameters.size) return false + for ((index, valueParameter) in declarationValueParameters.withIndex()) { + val targetValueParameter = valueParameters[index] + if (!(valueParameter isSameAs targetValueParameter)) return false + } + + return true +} + +private infix fun IrTypeParameter.isSameAs(typeParameter: TypeParameter): Boolean { + if (name != typeParameter.name) return false + if (variance.ordinal != typeParameter.varianceOrdinal) return false + if (isReified != typeParameter.isReified) return false + val superTypes = superTypes + if (superTypes.size != typeParameter.bounds.size) return false + + for ((index, superType) in superTypes.withIndex()) { + val typeBound = typeParameter.bounds[index] + if (superType.classFqName != typeBound?.asSingleFqName()) return false + } + + return true +} + +private infix fun IrValueParameter.isSameAs(valueParameter: ValueParameter): Boolean { + if (name != valueParameter.name) return false + return type.classFqName == valueParameter.type?.asSingleFqName() +} diff --git a/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/checker/SuspendTransformCollectionElementChecker.kt b/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/checker/SuspendTransformCollectionElementChecker.kt deleted file mode 100644 index 5dd8a15..0000000 --- a/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/checker/SuspendTransformCollectionElementChecker.kt +++ /dev/null @@ -1,21 +0,0 @@ -package love.forte.plugin.suspendtrans.checker - -import org.jetbrains.kotlin.descriptors.DeclarationDescriptor -import org.jetbrains.kotlin.psi.KtDeclaration -import org.jetbrains.kotlin.resolve.checkers.DeclarationChecker -import org.jetbrains.kotlin.resolve.checkers.DeclarationCheckerContext - - -/** - * - * @author ForteScarlet - */ -class SuspendTransformCollectionElementChecker : DeclarationChecker { - override fun check( - declaration: KtDeclaration, - descriptor: DeclarationDescriptor, - context: DeclarationCheckerContext - ) { - - } -} \ No newline at end of file diff --git a/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/checker/SuspendTransformComponentContainerContributor.kt b/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/checker/SuspendTransformComponentContainerContributor.kt deleted file mode 100644 index daf10b1..0000000 --- a/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/checker/SuspendTransformComponentContainerContributor.kt +++ /dev/null @@ -1,19 +0,0 @@ -package love.forte.plugin.suspendtrans.checker - -import org.jetbrains.kotlin.container.StorageComponentContainer -import org.jetbrains.kotlin.descriptors.ModuleDescriptor -import org.jetbrains.kotlin.extensions.StorageComponentContainerContributor -import org.jetbrains.kotlin.platform.TargetPlatform - - -/** - * - * @author ForteScarlet - */ -open class SuspendTransformComponentContainerContributor : StorageComponentContainerContributor { - override fun registerModuleComponents( - container: StorageComponentContainer, platform: TargetPlatform, moduleDescriptor: ModuleDescriptor - ) { - //container.useInstance(SuspendTransformCollectionElementChecker()) - } -} \ No newline at end of file diff --git a/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/k2/fir/SuspendTransformFirExtensionRegistrar.kt b/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirExtensionRegistrar.kt similarity index 64% rename from compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/k2/fir/SuspendTransformFirExtensionRegistrar.kt rename to compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirExtensionRegistrar.kt index 0861b02..19ef9e1 100644 --- a/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/k2/fir/SuspendTransformFirExtensionRegistrar.kt +++ b/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirExtensionRegistrar.kt @@ -1,16 +1,20 @@ -package love.forte.plugin.suspendtrans.k2.fir +package love.forte.plugin.suspendtrans.fir import love.forte.plugin.suspendtrans.SuspendTransformConfiguration import org.jetbrains.kotlin.fir.extensions.FirDeclarationGenerationExtension import org.jetbrains.kotlin.fir.extensions.FirExtensionRegistrar - /** * * @author ForteScarlet */ class SuspendTransformFirExtensionRegistrar(private val suspendTransformConfiguration: SuspendTransformConfiguration) : FirExtensionRegistrar() { override fun ExtensionRegistrarContext.configurePlugin() { - FirDeclarationGenerationExtension.Factory { session -> SuspendTransformFirTransformer(session, suspendTransformConfiguration) }.unaryPlus() + FirDeclarationGenerationExtension.Factory { session -> + SuspendTransformFirTransformer( + session, + suspendTransformConfiguration + ) + }.unaryPlus() } } diff --git a/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/k2/fir/SuspendTransformFirTransformer.kt b/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt similarity index 55% rename from compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/k2/fir/SuspendTransformFirTransformer.kt rename to compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt index b6723fc..906fdff 100644 --- a/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/k2/fir/SuspendTransformFirTransformer.kt +++ b/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt @@ -1,28 +1,31 @@ -package love.forte.plugin.suspendtrans.k2.fir +package love.forte.plugin.suspendtrans.fir -import love.forte.plugin.suspendtrans.MarkAnnotation -import love.forte.plugin.suspendtrans.SuspendTransformConfiguration -import love.forte.plugin.suspendtrans.TargetPlatform -import love.forte.plugin.suspendtrans.fqn +import love.forte.plugin.suspendtrans.* +import love.forte.plugin.suspendtrans.utils.CopyAnnotationsData import love.forte.plugin.suspendtrans.utils.TransformAnnotationData +import love.forte.plugin.suspendtrans.utils.toClassId +import love.forte.plugin.suspendtrans.utils.toInfo import org.jetbrains.kotlin.descriptors.Modality import org.jetbrains.kotlin.fir.FirSession +import org.jetbrains.kotlin.fir.analysis.checkers.collectUpperBounds import org.jetbrains.kotlin.fir.caches.FirCache import org.jetbrains.kotlin.fir.caches.firCachesFactory import org.jetbrains.kotlin.fir.caches.getValue import org.jetbrains.kotlin.fir.copy +import org.jetbrains.kotlin.fir.declarations.* import org.jetbrains.kotlin.fir.declarations.builder.buildProperty import org.jetbrains.kotlin.fir.declarations.builder.buildPropertyAccessor import org.jetbrains.kotlin.fir.declarations.builder.buildSimpleFunctionCopy -import org.jetbrains.kotlin.fir.declarations.getAnnotationsByClassId -import org.jetbrains.kotlin.fir.declarations.origin -import org.jetbrains.kotlin.fir.declarations.resolvePhase import org.jetbrains.kotlin.fir.declarations.utils.isSuspend +import org.jetbrains.kotlin.fir.declarations.utils.modality +import org.jetbrains.kotlin.fir.expressions.FirAnnotation +import org.jetbrains.kotlin.fir.expressions.FirExpression +import org.jetbrains.kotlin.fir.expressions.builder.* import org.jetbrains.kotlin.fir.extensions.FirDeclarationGenerationExtension import org.jetbrains.kotlin.fir.extensions.FirDeclarationPredicateRegistrar import org.jetbrains.kotlin.fir.extensions.MemberGenerationContext import org.jetbrains.kotlin.fir.extensions.predicate.DeclarationPredicate -import org.jetbrains.kotlin.fir.resolve.fqName +import org.jetbrains.kotlin.fir.plugin.createConeType import org.jetbrains.kotlin.fir.scopes.impl.FirClassDeclaredMemberScope import org.jetbrains.kotlin.fir.scopes.processAllFunctions import org.jetbrains.kotlin.fir.symbols.SymbolInternals @@ -30,6 +33,8 @@ import org.jetbrains.kotlin.fir.symbols.impl.FirClassSymbol import org.jetbrains.kotlin.fir.symbols.impl.FirNamedFunctionSymbol import org.jetbrains.kotlin.fir.symbols.impl.FirPropertyAccessorSymbol import org.jetbrains.kotlin.fir.symbols.impl.FirPropertySymbol +import org.jetbrains.kotlin.fir.types.* +import org.jetbrains.kotlin.fir.types.builder.buildResolvedTypeRef import org.jetbrains.kotlin.name.CallableId import org.jetbrains.kotlin.name.ClassId import org.jetbrains.kotlin.name.FqName @@ -39,9 +44,10 @@ import org.jetbrains.kotlin.platform.isJs import org.jetbrains.kotlin.platform.isWasm import org.jetbrains.kotlin.platform.jvm.isJvm import org.jetbrains.kotlin.platform.konan.isNative +import org.jetbrains.kotlin.types.ConstantValueKind +import org.jetbrains.kotlin.types.checker.SimpleClassicTypeSystemContext.argumentsCount import java.util.concurrent.ConcurrentHashMap - /** * * @author ForteScarlet @@ -59,6 +65,7 @@ class SuspendTransformFirTransformer( private data class FunData( val annotationData: TransformAnnotationData, + val transformer: Transformer ) private val cache: FirCache, FirClassDeclaredMemberScope?>, Map>?, Nothing?> = @@ -94,16 +101,39 @@ class SuspendTransformFirTransformer( val originFunc = func.fir + val (functionAnnotations, _) = copyAnnotations(originFunc, funData) + val newFun = buildSimpleFunctionCopy(originFunc) { name = callableId.callableName - symbol = FirNamedFunctionSymbol(callableId) + val newFunSymbol = FirNamedFunctionSymbol(callableId) + symbol = newFunSymbol status = originFunc.status.copy( isSuspend = false, - modality = if (originFunc.status.isOverride) Modality.OPEN else originFunc.status.modality, + modality = originFunc.syntheticModifier ) - origin = SuspendTransformPluginKey.origin + + annotations.clear() + annotations.addAll(functionAnnotations) + body = null + + val returnType = resolveReturnType(originFunc, funData) + + returnTypeRef = returnType + + origin = SuspendTransformPluginKey( + data = SuspendTransformUserDataFir( + originSymbol = symbol.asOriginSymbol( + typeParameters = typeParameters, + valueParameters = valueParameters, + returnType.coneTypeOrNull?.classId + ), + asProperty = false, + transformer = funData.transformer + ) + ).origin } + funList.add(newFun.symbol) } } @@ -128,6 +158,9 @@ class SuspendTransformFirTransformer( // generate val original = func.fir + val (functionAnnotations, propertyAnnotations) = + copyAnnotations(original, funData) + val p = buildProperty { name = callableId.callableName symbol = FirPropertySymbol(callableId) @@ -138,21 +171,41 @@ class SuspendTransformFirTransformer( attributes = original.attributes.copy() status = original.status.copy( isSuspend = false, - modality = if (original.status.isOverride) Modality.OPEN else original.status.modality, +// modality = if (original.status.isOverride) Modality.OPEN else original.status.modality, + modality = original.syntheticModifier, ) returnTypeRef = original.returnTypeRef deprecationsProvider = original.deprecationsProvider containerSource = original.containerSource dispatchReceiverType = original.dispatchReceiverType contextReceivers.addAll(original.contextReceivers) - annotations.addAll(original.annotations) // TODO + // annotations + annotations.addAll(propertyAnnotations) typeParameters.addAll(original.typeParameters) getter = buildPropertyAccessor { symbol = FirPropertyAccessorSymbol() source = original.source resolvePhase = original.resolvePhase moduleData = original.moduleData - origin = original.origin + // annotations + annotations.addAll(functionAnnotations) + + val returnType = resolveReturnType(original, funData) + + returnTypeRef = returnType + + origin = SuspendTransformPluginKey( + data = SuspendTransformUserDataFir( + originSymbol = symbol.asOriginSymbol( + typeParameters = typeParameters, + valueParameters = valueParameters, + returnType.coneTypeOrNull?.classId + ), + asProperty = true, + transformer = funData.transformer + ) + ).origin + attributes = original.attributes.copy() status = original.status returnTypeRef = original.returnTypeRef @@ -180,10 +233,10 @@ class SuspendTransformFirTransformer( for (value in suspendTransformConfiguration.transformers.values) { for (transformer in value) { val afq = transformer.markAnnotation.fqName - if (predicate == null) { - predicate = metaAnnotated(setOf(afq), false) + predicate = if (predicate == null) { + annotated(afq) } else { - predicate = predicate or metaAnnotated(setOf(afq), false) + predicate or annotated(afq) } } } @@ -196,28 +249,6 @@ class SuspendTransformFirTransformer( * otherwise, the annotation remains unresolved */ override fun FirDeclarationPredicateRegistrar.registerPredicates() { - - -// val serializable = suspendTransformConfiguration.transformers.values -// .asSequence() -// .flatMap { -// it.map { t -> -// DeclarationPredicate.create { annotated(t.markAnnotation.fqName) } -// } -// } -// .reduce { a, b -> a.or(b) } - -// val serializable = -// LookupPredicate.create { -// val annotationFqNames = suspendTransformConfiguration.transformers.values.flatMapTo(mutableSetOf()) { -// it.map { t -> -// t.markAnnotation.fqName -// } -// } -// -// annotated(annotationFqNames) -// } - register(annotationPredicates) } @@ -227,7 +258,6 @@ class SuspendTransformFirTransformer( ): Map>? { if (declaredScope == null) return null - fun check(targetPlatform: TargetPlatform): Boolean { val platform = classSymbol.moduleData.platform @@ -264,10 +294,6 @@ class SuspendTransformFirTransformer( ).firstOrNull() ?: continue - println("!!${functionName}.anno: ${anno.fqName(session)}") - println("!!${functionName}.anno.mapping: ${anno.argumentMapping.mapping}") - println() - // TODO 读不到注解的参数? val annoData = TransformAnnotationData.of( @@ -280,16 +306,147 @@ class SuspendTransformFirTransformer( defaultAsProperty = markAnnotation.defaultAsProperty, ) - println("AnnoData: $annoData") - map.computeIfAbsent(Name.identifier(annoData.functionName)) { ConcurrentHashMap() }[func] = - FunData(annoData) + FunData(annoData, transformer) } } } return map } + + private fun resolveReturnType(original: FirSimpleFunction, funData: FunData): FirTypeRef { + val originalReturnTypeRef = original.returnTypeRef + val transformer = funData.transformer + val returnType = transformer.transformReturnType + ?: return originalReturnTypeRef + + var typeArguments: Array = emptyArray() + + if (transformer.transformReturnTypeGeneric) { + typeArguments = arrayOf(ConeKotlinTypeProjectionOut(originalReturnTypeRef.coneType)) + } + + val resultConeType = returnType.toClassId().createConeType( + session = session, + typeArguments, + nullable = returnType.nullable + ) + + return buildResolvedTypeRef { + type = resultConeType + } + } + + + /** + * @return function annotations `to` property annotations. + */ + private fun copyAnnotations( + original: FirSimpleFunction, funData: FunData, + ): Pair, List> { + val transformer = funData.transformer + + val (copyFunction, excludes, includes) = CopyAnnotationsData( + transformer.copyAnnotationsToSyntheticFunction, + transformer.copyAnnotationExcludes.map { it.toClassId() }, + transformer.syntheticFunctionIncludeAnnotations.map { it.toInfo() } + ) + + val annotationList = mutableListOf() + + with(annotationList) { + if (copyFunction) { + val notCompileAnnotationsCopied = original.annotations.filterNot { + val annotationClassId = it.toAnnotationClassId(session) ?: return@filterNot true + excludes.any { ex -> annotationClassId == ex } + } + + addAll(notCompileAnnotationsCopied) + } + + // try add @Generated(by = ...) + runCatching { +// val generatedAnnotation = buildAnnotation { +// annotationTypeRef = buildResolvedTypeRef { +// type = generatedAnnotationClassId.createConeType(session) +// } +// argumentMapping = buildAnnotationArgumentMapping { +// includeGeneratedArguments(original) +// } +// } +// add(generatedAnnotation) + }.getOrElse { e -> + // Where is log? + e.printStackTrace() + } + + // add includes + includes.forEach { include -> + val classId = include.classId + println("!!!include: $include") + println("!!!include: $classId") + val includeAnnotation = buildAnnotation { + argumentMapping = buildAnnotationArgumentMapping() + annotationTypeRef = buildResolvedTypeRef { + type = classId.createConeType(session) + } + } + add(includeAnnotation) + } + } + + return annotationList to emptyList() + } + + + private fun FirAnnotationArgumentMappingBuilder.includeGeneratedArguments(function: FirSimpleFunction) { + fun MutableList.addString(value: String) { + val expression = buildConstExpression( + source = null, + kind = ConstantValueKind.String, + value = value, + setType = false + ) + add(expression) + } + + fun ConeKotlinType.typeString(): String { + return buildString { + append(classId?.asFqNameString()) + collectUpperBounds() + .takeIf { it.isNotEmpty() } + ?.also { upperBounds -> + upperBounds.joinTo(this, "&") { type -> + type.classId?.asFqNameString() ?: "?NULL?" + } + } + if (kotlin.runCatching { argumentsCount() }.getOrElse { 0 } > 0) { + typeArguments.joinTo(this, ", ", "<", ">") { argument -> + argument.type?.classId?.asFqNameString() ?: "?NULL?" + } + } + } + } + + with(mapping) { + put(Name.identifier("by"), buildArrayLiteral { + argumentList = buildArgumentList { + with(arguments) { + addString(function.name.asString()) + function.valueParameters.forEach { vp -> + addString(vp.name.asString()) + vp.returnTypeRef.coneTypeOrNull?.also { coneType -> + addString(coneType.typeString()) + } + } + addString(function.returnTypeRef.coneTypeOrNull?.typeString() ?: "?") + } + } + }) + } + } + } @@ -303,3 +460,10 @@ private val MarkAnnotation.fqName: FqName get() { return FqName(classInfo.packageName + "." + classInfo.className) } + +private val FirSimpleFunction.syntheticModifier: Modality? + get() = when { + status.isOverride -> Modality.OPEN + modality == Modality.ABSTRACT -> Modality.OPEN + else -> status.modality + } diff --git a/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformPluginKey.kt b/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformPluginKey.kt new file mode 100644 index 0000000..33a708f --- /dev/null +++ b/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformPluginKey.kt @@ -0,0 +1,10 @@ +package love.forte.plugin.suspendtrans.fir + +import love.forte.plugin.suspendtrans.SuspendTransformUserDataFir +import org.jetbrains.kotlin.GeneratedDeclarationKey + +data class SuspendTransformPluginKey(val data: SuspendTransformUserDataFir) : GeneratedDeclarationKey() { + override fun toString(): String { + return "SuspendTransformPlugin(data=$data)" + } +} diff --git a/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/ir/SuspendTransformTransformer.kt b/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/ir/SuspendTransformTransformer.kt index 26982e1..5d4f9d7 100644 --- a/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/ir/SuspendTransformTransformer.kt +++ b/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/ir/SuspendTransformTransformer.kt @@ -1,14 +1,12 @@ package love.forte.plugin.suspendtrans.ir -import love.forte.plugin.suspendtrans.SuspendTransformConfiguration -import love.forte.plugin.suspendtrans.SuspendTransformUserData -import love.forte.plugin.suspendtrans.SuspendTransformUserDataKey -import love.forte.plugin.suspendtrans.fqn +import love.forte.plugin.suspendtrans.* +import love.forte.plugin.suspendtrans.k2.fir.SuspendTransformPluginKey import love.forte.plugin.suspendtrans.utils.* import org.jetbrains.kotlin.backend.common.IrElementTransformerVoidWithContext import org.jetbrains.kotlin.backend.common.extensions.IrPluginContext +import org.jetbrains.kotlin.backend.wasm.ir2wasm.getSourceLocation import org.jetbrains.kotlin.descriptors.CallableDescriptor -import org.jetbrains.kotlin.descriptors.SimpleFunctionDescriptor import org.jetbrains.kotlin.ir.IrStatement import org.jetbrains.kotlin.ir.ObsoleteDescriptorBasedAPI import org.jetbrains.kotlin.ir.UNDEFINED_OFFSET @@ -22,10 +20,13 @@ import org.jetbrains.kotlin.ir.expressions.impl.IrFunctionExpressionImpl import org.jetbrains.kotlin.ir.expressions.impl.IrTypeOperatorCallImpl import org.jetbrains.kotlin.ir.symbols.IrSimpleFunctionSymbol import org.jetbrains.kotlin.ir.types.* +import org.jetbrains.kotlin.ir.util.IrMessageLogger +import org.jetbrains.kotlin.ir.util.fileEntry import org.jetbrains.kotlin.ir.util.isAnnotationWithEqualFqName import org.jetbrains.kotlin.ir.util.primaryConstructor import org.jetbrains.kotlin.name.ClassId import org.jetbrains.kotlin.name.FqName +import org.jetbrains.kotlin.wasm.ir.source.location.SourceLocation /** * @@ -36,6 +37,12 @@ class SuspendTransformTransformer( private val pluginContext: IrPluginContext, ) : IrElementTransformerVoidWithContext() { + // TODO What should be used in K2? + private val reporter = kotlin.runCatching { + // error: "This API is not supported for K2" + pluginContext.createDiagnosticReporter(PLUGIN_REPORT_ID) + }.getOrNull() + @OptIn(ObsoleteDescriptorBasedAPI::class) override fun visitFunctionNew(declaration: IrFunction): IrStatement { resolveFunctionBodyByDescriptor(declaration, declaration.descriptor) @@ -43,7 +50,6 @@ class SuspendTransformTransformer( return super.visitFunctionNew(declaration) } - @OptIn(ObsoleteDescriptorBasedAPI::class) override fun visitPropertyNew(declaration: IrProperty): IrStatement { val getter = declaration.getter ?: return super.visitPropertyNew(declaration) @@ -52,31 +58,69 @@ class SuspendTransformTransformer( return super.visitPropertyNew(declaration) } + @OptIn(ObsoleteDescriptorBasedAPI::class) private fun resolveFunctionBodyByDescriptor(declaration: IrFunction, descriptor: CallableDescriptor): IrFunction? { - val userData = descriptor.getUserData(SuspendTransformUserDataKey) ?: return null - val callableFunction = - pluginContext.referenceFunctions(userData.transformer.transformFunctionInfo.toCallableId()).firstOrNull() - ?: throw IllegalStateException("Transform function ${userData.transformer.transformFunctionInfo} not found") + // K2 + val pluginKey = (declaration.origin as? IrDeclarationOrigin.GeneratedByPlugin) + ?.pluginKey as? SuspendTransformPluginKey + + // K1 ? + val userData = descriptor.getUserData(SuspendTransformUserDataKey) + + val generatedOriginFunction: IrFunction? = when { + pluginKey != null -> { + val callableFunction = + pluginContext.referenceFunctions(pluginKey.data.transformer.transformFunctionInfo.toCallableId()) + .firstOrNull() + ?: throw IllegalStateException("Transform function ${pluginKey.data.transformer.transformFunctionInfo} not found") + + resolveFunctionBody( + declaration, + { f -> pluginKey.data.originSymbol.checkSame(f).also { println("Check result: $it: ($f(${f.name}) same ${pluginKey.data.originSymbol})") } }, + callableFunction + )?.also { generatedOriginFunction -> + postProcessGenerateOriginFunction( + generatedOriginFunction, + pluginKey.data.transformer.originFunctionIncludeAnnotations + ) + } + } - val generatedOriginFunction = resolveFunctionBody(declaration, userData.originFunction, callableFunction) + userData != null -> { + val callableFunction = + pluginContext.referenceFunctions(userData.transformer.transformFunctionInfo.toCallableId()) + .firstOrNull() + ?: throw IllegalStateException("Transform function ${userData.transformer.transformFunctionInfo} not found") + + resolveFunctionBody( + declaration, + { f -> f.descriptor == userData.originFunction }, + callableFunction + )?.also { generatedOriginFunction -> + postProcessGenerateOriginFunction( + generatedOriginFunction, + userData.transformer.originFunctionIncludeAnnotations + ) + } + } - if (generatedOriginFunction != null) { - postProcessGenerateOriginFunction(generatedOriginFunction, userData) + else -> return null } return generatedOriginFunction } - private fun postProcessGenerateOriginFunction(function: IrFunction, userData: SuspendTransformUserData) { + private fun postProcessGenerateOriginFunction( + function: IrFunction, + originFunctionIncludeAnnotations: List + ) { function.annotations = buildList { val currentAnnotations = function.annotations fun hasAnnotation(name: FqName): Boolean = currentAnnotations.any { a -> a.isAnnotationWithEqualFqName(name) } addAll(currentAnnotations) - val syntheticFunctionIncludes = userData.transformer.originFunctionIncludeAnnotations - - syntheticFunctionIncludes.forEach { include -> + originFunctionIncludeAnnotations.forEach { include -> val classId = include.classInfo.toClassId() val annotationClass = pluginContext.referenceClass(classId) ?: return@forEach if (!include.repeatable && hasAnnotation(classId.asSingleFqName())) { @@ -91,46 +135,55 @@ class SuspendTransformTransformer( @OptIn(ObsoleteDescriptorBasedAPI::class) private fun resolveFunctionBody( function: IrFunction, - originFunctionDescriptor: SimpleFunctionDescriptor, + checkIsOriginFunction: (IrFunction) -> Boolean, transformTargetFunctionCall: IrSimpleFunctionSymbol, ): IrFunction? { val parent = function.parent - println("!!!resolveFunctionBody.function: $function") - println("!!!resolveFunctionBody.function.parent: ${function.parent}") if (parent is IrDeclarationContainer) { -// parent.findDeclaration<> { } val originFunctions = parent.declarations.filterIsInstance() - .filter { f -> f.descriptor == originFunctionDescriptor } + .filter { checkIsOriginFunction(it) } if (originFunctions.size != 1) { - // maybe override function - /* - interface A { - @JvmBlocking suspend fun a(): Int + val message = + "Transform function $function (${function.name}) 's originFunctions.size should be 1, but ${originFunctions.size} (findIn = ${(parent as? IrDeclaration)?.descriptor}, originFunctions = $originFunctions)" + + val location = when (val sourceLocation = + function.getSourceLocation(runCatching { function.fileEntry }.getOrNull())) { + is SourceLocation.Location -> { + IrMessageLogger.Location( + filePath = sourceLocation.file, + line = sourceLocation.line, + column = sourceLocation.column + ) } - interface B : A { - // here - override suspend fun a(): Int = 1 - } - */ - System.err.println( - "originFunctions.size should be 1, but ${originFunctions.size} (originFunctionDescriptor = $originFunctionDescriptor, findIn = ${(parent as? IrDeclaration)?.descriptor}, originFunctions = $originFunctions)" - ) + else -> null + } + + if (reporter != null) { + reporter.report( + IrMessageLogger.Severity.WARNING, + message, + location + ) + } else { + // TODO In K2? + System.err.println(message) + } + + return null } -// require(originFunctions.size == 1) { -// } val originFunction = originFunctions.first() - function.body = null function.body = generateTransformBodyForFunctionLambda( pluginContext, function, originFunction, transformTargetFunctionCall ) + return originFunction } diff --git a/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/k2/fir/SuspendTransformPluginKey.kt b/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/k2/fir/SuspendTransformPluginKey.kt deleted file mode 100644 index 44ff86f..0000000 --- a/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/k2/fir/SuspendTransformPluginKey.kt +++ /dev/null @@ -1,9 +0,0 @@ -package love.forte.plugin.suspendtrans.k2.fir - -import org.jetbrains.kotlin.GeneratedDeclarationKey - -object SuspendTransformPluginKey : GeneratedDeclarationKey() { - override fun toString(): String { - return "SuspendTransform GeneratedDeclarationKey" - } -} diff --git a/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/symbol/AbstractSuspendTransformFunctionDescriptor.kt b/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/symbol/AbstractSuspendTransformFunctionDescriptor.kt index f9b5f17..87cf3d0 100644 --- a/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/symbol/AbstractSuspendTransformFunctionDescriptor.kt +++ b/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/symbol/AbstractSuspendTransformFunctionDescriptor.kt @@ -61,27 +61,29 @@ sealed class AbstractSuspendTransformFunctionDescriptor( emptyList() } - return KotlinTypeFactory.simpleNotNullType( + return KotlinTypeFactory.simpleType( TypeAttributes.Empty, - returnTypeClass, - arguments + returnTypeClass.typeConstructor, + arguments, + nullable = returnType.nullable ) } open fun init() { + val returnType = returnType(originFunction.returnType) + initialize( originFunction.extensionReceiverParameter?.copy(this), classDescriptor.thisAsReceiverParameter, originFunction.contextReceiverParameters.map { it.copy(this) }, originFunction.typeParameters.toList(), originFunction.valueParameters.map { it.copy(this) }, - returnType(originFunction.returnType), + returnType, modality(originFunction), originFunction.visibility, mutableMapOf, Any>(SuspendTransformUserDataKey to userData) ) this.isSuspend = false - } protected open fun transformToPropertyInternal(): AbstractSuspendTransformProperty { diff --git a/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/symbol/SuspendTransformSyntheticResolveExtension.kt b/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/symbol/SuspendTransformSyntheticResolveExtension.kt index 7474f84..efe0470 100644 --- a/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/symbol/SuspendTransformSyntheticResolveExtension.kt +++ b/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/symbol/SuspendTransformSyntheticResolveExtension.kt @@ -1,10 +1,7 @@ package love.forte.plugin.suspendtrans.symbol import love.forte.plugin.suspendtrans.* -import love.forte.plugin.suspendtrans.utils.TransformAnnotationData -import love.forte.plugin.suspendtrans.utils.filterNotCompileAnnotations -import love.forte.plugin.suspendtrans.utils.findClassDescriptor -import love.forte.plugin.suspendtrans.utils.resolveAnnotationData +import love.forte.plugin.suspendtrans.utils.* import org.jetbrains.kotlin.backend.common.descriptors.allParameters import org.jetbrains.kotlin.descriptors.* import org.jetbrains.kotlin.descriptors.annotations.AnnotationDescriptor @@ -242,6 +239,9 @@ open class SuspendTransformSyntheticResolveExtension(open val configuration: Sus } +/** + * annotations to property annotations + */ private fun copyAnnotations( originFunction: SimpleFunctionDescriptor, transformer: Transformer @@ -292,12 +292,6 @@ private fun copyAnnotations( return Annotations.create(annotationsList) to Annotations.EMPTY } -private data class CopyAnnotationsData( - val copyFunction: Boolean, - val excludes: List, - val includes: List -) - private class StringArrayValue(values: List) : ArrayValue(values, { module -> module.builtIns.getArrayType( Variance.INVARIANT, module.builtIns.stringType @@ -320,17 +314,3 @@ private fun SimpleFunctionDescriptor.toGeneratedByDescriptorInfo(): List.filterNotCompileAnnotations(): List = filterNot { val annotationFqNameUnsafe = it.annotationClass?.fqNameUnsafe ?: return@filterNot true - +// annotationFqNameUnsafe == toJvmAsyncAnnotationName.toUnsafe() || annotationFqNameUnsafe == toJvmBlockingAnnotationName.toUnsafe() || annotationFqNameUnsafe == toJsPromiseAnnotationName.toUnsafe() } +//fun Iterable.filterNotCompileAnnotations(session: FirSession): List = filterNot { +// val annotationFqName = it.fqName(session) ?: return@filterNot true +// val annotationFqNameUnsafe = it.annotationClass?.fqNameUnsafe ?: return@filterNot true + +// annotationFqName == toJvmAsyncAnnotationName.toUnsafe() +// || annotationFqName == toJvmBlockingAnnotationName.toUnsafe() +// || annotationFqName == toJsPromiseAnnotationName.toUnsafe() +//} + data class TransformAnnotationData( //val annotationDescriptor: AnnotationDescriptor, val baseName: String?, diff --git a/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/utils/CopyAnnotationUtils.kt b/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/utils/CopyAnnotationUtils.kt new file mode 100644 index 0000000..6ff9140 --- /dev/null +++ b/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/utils/CopyAnnotationUtils.kt @@ -0,0 +1,19 @@ +package love.forte.plugin.suspendtrans.utils + +import love.forte.plugin.suspendtrans.IncludeAnnotation +import org.jetbrains.kotlin.name.ClassId + +data class CopyAnnotationsData( + val copyFunction: Boolean, + val excludes: List, + val includes: List +) + +data class IncludeAnnotationInfo( + val classId: ClassId, + val repeatable: Boolean +) + +fun IncludeAnnotation.toInfo(): love.forte.plugin.suspendtrans.utils.IncludeAnnotationInfo { + return IncludeAnnotationInfo(classInfo.toClassId(), repeatable) +} diff --git a/compiler/suspend-transform-plugin/src/testData/codegen/basic.kt b/compiler/suspend-transform-plugin/src/testData/codegen/basic.kt index e44c5ca..8e72785 100644 --- a/compiler/suspend-transform-plugin/src/testData/codegen/basic.kt +++ b/compiler/suspend-transform-plugin/src/testData/codegen/basic.kt @@ -5,28 +5,26 @@ import love.forte.plugin.suspendtrans.annotation.JvmAsync import love.forte.plugin.suspendtrans.annotation.JvmBlocking -//import kotlinx.coroutines.CoroutineScope -//import kotlin.coroutines.CoroutineContext -//import kotlin.coroutines.EmptyCoroutineContext class BasicFoo { @JvmAsync - suspend fun foo(): String = "" + suspend fun foo(): String = "foo" } -class BasicBar -// : CoroutineScope -{ - //override val coroutineContext: CoroutineContext = EmptyCoroutineContext +class BasicBar { @JvmAsync - suspend fun bar(): String = "" + suspend fun bar(): String = "bar" @JvmAsync - suspend fun bar(i: Int): String = "" + suspend fun bar2(i: Int): String = "bar2" } interface InterfaceBar { @JvmAsync suspend fun bar(): String @JvmAsync - suspend fun bar(i: Int): String + suspend fun bar2(i: Int): String + + fun asyncBase(i: Int): ResultValue } + +class ResultValue diff --git a/gradle.properties b/gradle.properties index e56739e..a1cdb6d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -7,7 +7,7 @@ org.gradle.jvmargs=-Xmx8G -Xms2G -XX:MaxMetaspaceSize=1G -Dfile.encoding=UTF-8 # test #Compose -#org.jetbrains.compose.experimental.wasm.enabled=true +org.jetbrains.compose.experimental.wasm.enabled=true #Development #development=true diff --git a/kotlin-js-store/yarn.lock b/kotlin-js-store/yarn.lock index 018da8d..269a69c 100644 --- a/kotlin-js-store/yarn.lock +++ b/kotlin-js-store/yarn.lock @@ -52,11 +52,46 @@ "@jridgewell/resolve-uri" "^3.1.0" "@jridgewell/sourcemap-codec" "^1.4.14" +"@leichtgewicht/ip-codec@^2.0.1": + version "2.0.4" + resolved "https://registry.npmjs.org/@leichtgewicht/ip-codec/-/ip-codec-2.0.4.tgz#b2ac626d6cb9c8718ab459166d4bb405b8ffa78b" + integrity sha512-Hcv+nVC0kZnQ3tD9GVu5xSMR4VVYOteQIr/hwFPVEvPdlXqgGEuRjiheChHgdM+JyqdgNcmzZOX/tnl0JOiI7A== + "@socket.io/component-emitter@~3.1.0": version "3.1.0" resolved "https://registry.yarnpkg.com/@socket.io/component-emitter/-/component-emitter-3.1.0.tgz#96116f2a912e0c02817345b3c10751069920d553" integrity sha512-+9jVqKhRSpsc591z5vX+X5Yyw+he/HCB4iQ/RYxw35CEPaY1gnsNE43nf9n9AaYjAQrTiI/mOwKUKdUs9vf7Xg== +"@types/body-parser@*": + version "1.19.5" + resolved "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.19.5.tgz#04ce9a3b677dc8bd681a17da1ab9835dc9d3ede4" + integrity sha512-fB3Zu92ucau0iQ0JMCFQE7b/dv8Ot07NI3KaZIkIUNXq82k4eBAqUaneXfleGY9JWskeS9y+u0nXMyspcuQrCg== + dependencies: + "@types/connect" "*" + "@types/node" "*" + +"@types/bonjour@^3.5.9": + version "3.5.13" + resolved "https://registry.npmjs.org/@types/bonjour/-/bonjour-3.5.13.tgz#adf90ce1a105e81dd1f9c61fdc5afda1bfb92956" + integrity sha512-z9fJ5Im06zvUL548KvYNecEVlA7cVDkGUi6kZusb04mpyEFKCIZJvloCcmpmLaIahDpOQGHaHmG6imtPMmPXGQ== + dependencies: + "@types/node" "*" + +"@types/connect-history-api-fallback@^1.3.5": + version "1.5.4" + resolved "https://registry.npmjs.org/@types/connect-history-api-fallback/-/connect-history-api-fallback-1.5.4.tgz#7de71645a103056b48ac3ce07b3520b819c1d5b3" + integrity sha512-n6Cr2xS1h4uAulPRdlw6Jl6s1oG8KrVilPN2yUITEs+K48EzMJJ3W1xy8K5eWuFvjp3R74AOIGSmp2UfBJ8HFw== + dependencies: + "@types/express-serve-static-core" "*" + "@types/node" "*" + +"@types/connect@*": + version "3.4.38" + resolved "https://registry.npmjs.org/@types/connect/-/connect-3.4.38.tgz#5ba7f3bc4fbbdeaff8dded952e5ff2cc53f8d858" + integrity sha512-K6uROf1LD88uDQqJCktA4yzL1YYAK6NgfsI0v/mTgyPKWsX1CnJ0XPSDhViejru1GcRkLWb8RlzFYJRqGUbaug== + dependencies: + "@types/node" "*" + "@types/cookie@^0.4.1": version "0.4.1" resolved "https://registry.yarnpkg.com/@types/cookie/-/cookie-0.4.1.tgz#bfd02c1f2224567676c1545199f87c3a861d878d" @@ -90,11 +125,60 @@ resolved "https://registry.yarnpkg.com/@types/estree/-/estree-1.0.5.tgz#a6ce3e556e00fd9895dd872dd172ad0d4bd687f4" integrity sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw== -"@types/json-schema@*", "@types/json-schema@^7.0.8": +"@types/express-serve-static-core@*", "@types/express-serve-static-core@^4.17.33": + version "4.17.41" + resolved "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.17.41.tgz#5077defa630c2e8d28aa9ffc2c01c157c305bef6" + integrity sha512-OaJ7XLaelTgrvlZD8/aa0vvvxZdUmlCn6MtWeB7TkiKW70BQLc9XEPpDLPdbo52ZhXUCrznlWdCHWxJWtdyajA== + dependencies: + "@types/node" "*" + "@types/qs" "*" + "@types/range-parser" "*" + "@types/send" "*" + +"@types/express@*", "@types/express@^4.17.13": + version "4.17.21" + resolved "https://registry.npmjs.org/@types/express/-/express-4.17.21.tgz#c26d4a151e60efe0084b23dc3369ebc631ed192d" + integrity sha512-ejlPM315qwLpaQlQDTjPdsUFSc6ZsP4AN6AlWnogPjQ7CVi7PYF3YVz+CY3jE2pwYf7E/7HlDAN0rV2GxTG0HQ== + dependencies: + "@types/body-parser" "*" + "@types/express-serve-static-core" "^4.17.33" + "@types/qs" "*" + "@types/serve-static" "*" + +"@types/http-errors@*": + version "2.0.4" + resolved "https://registry.npmjs.org/@types/http-errors/-/http-errors-2.0.4.tgz#7eb47726c391b7345a6ec35ad7f4de469cf5ba4f" + integrity sha512-D0CFMMtydbJAegzOyHjtiKPLlvnm3iTZyZRSZoLq2mRhDdmLfIWOCYPfQJ4cu2erKghU++QvjcUjp/5h7hESpA== + +"@types/http-proxy@^1.17.8": + version "1.17.14" + resolved "https://registry.npmjs.org/@types/http-proxy/-/http-proxy-1.17.14.tgz#57f8ccaa1c1c3780644f8a94f9c6b5000b5e2eec" + integrity sha512-SSrD0c1OQzlFX7pGu1eXxSEjemej64aaNPRhhVYUGqXh0BtldAAx37MG8btcumvpgKyZp1F5Gn3JkktdxiFv6w== + dependencies: + "@types/node" "*" + +"@types/json-schema@*", "@types/json-schema@^7.0.8", "@types/json-schema@^7.0.9": version "7.0.15" resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.15.tgz#596a1747233694d50f6ad8a7869fcb6f56cf5841" integrity sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA== +"@types/mime@*": + version "3.0.4" + resolved "https://registry.npmjs.org/@types/mime/-/mime-3.0.4.tgz#2198ac274de6017b44d941e00261d5bc6a0e0a45" + integrity sha512-iJt33IQnVRkqeqC7PzBHPTC6fDlRNRW8vjrgqtScAhrmMwe8c4Eo7+fUGTa+XdWrpEgpyKWMYmi2dIwMAYRzPw== + +"@types/mime@^1": + version "1.3.5" + resolved "https://registry.npmjs.org/@types/mime/-/mime-1.3.5.tgz#1ef302e01cf7d2b5a0fa526790c9123bf1d06690" + integrity sha512-/pyBZWSLD2n0dcHE3hq8s8ZvcETHtEuF+3E7XVt0Ig2nvsVQXdghHVcEkIWjy9A0wKfTn97a/PSDYohKIlnP/w== + +"@types/node-forge@^1.3.0": + version "1.3.11" + resolved "https://registry.npmjs.org/@types/node-forge/-/node-forge-1.3.11.tgz#0972ea538ddb0f4d9c2fa0ec5db5724773a604da" + integrity sha512-FQx220y22OKNTqaByeBGqHWYz4cl94tpcxeFdvBo3wjG6XPBuZ0BNgNZRV5J5TFmmcsJ4IzsLkmGRiQbnYsBEQ== + dependencies: + "@types/node" "*" + "@types/node@*", "@types/node@>=10.0.0": version "20.10.5" resolved "https://registry.yarnpkg.com/@types/node/-/node-20.10.5.tgz#47ad460b514096b7ed63a1dae26fad0914ed3ab2" @@ -102,6 +186,59 @@ dependencies: undici-types "~5.26.4" +"@types/qs@*": + version "6.9.11" + resolved "https://registry.npmjs.org/@types/qs/-/qs-6.9.11.tgz#208d8a30bc507bd82e03ada29e4732ea46a6bbda" + integrity sha512-oGk0gmhnEJK4Yyk+oI7EfXsLayXatCWPHary1MtcmbAifkobT9cM9yutG/hZKIseOU0MqbIwQ/u2nn/Gb+ltuQ== + +"@types/range-parser@*": + version "1.2.7" + resolved "https://registry.npmjs.org/@types/range-parser/-/range-parser-1.2.7.tgz#50ae4353eaaddc04044279812f52c8c65857dbcb" + integrity sha512-hKormJbkJqzQGhziax5PItDUTMAM9uE2XXQmM37dyd4hVM+5aVl7oVxMVUiVQn2oCQFN/LKCZdvSM0pFRqbSmQ== + +"@types/retry@0.12.0": + version "0.12.0" + resolved "https://registry.npmjs.org/@types/retry/-/retry-0.12.0.tgz#2b35eccfcee7d38cd72ad99232fbd58bffb3c84d" + integrity sha512-wWKOClTTiizcZhXnPY4wikVAwmdYHp8q6DmC+EJUzAMsycb7HB32Kh9RN4+0gExjmPmZSAQjgURXIGATPegAvA== + +"@types/send@*": + version "0.17.4" + resolved "https://registry.npmjs.org/@types/send/-/send-0.17.4.tgz#6619cd24e7270793702e4e6a4b958a9010cfc57a" + integrity sha512-x2EM6TJOybec7c52BX0ZspPodMsQUd5L6PRwOunVyVUhXiBSKf3AezDL8Dgvgt5o0UfKNfuA0eMLr2wLT4AiBA== + dependencies: + "@types/mime" "^1" + "@types/node" "*" + +"@types/serve-index@^1.9.1": + version "1.9.4" + resolved "https://registry.npmjs.org/@types/serve-index/-/serve-index-1.9.4.tgz#e6ae13d5053cb06ed36392110b4f9a49ac4ec898" + integrity sha512-qLpGZ/c2fhSs5gnYsQxtDEq3Oy8SXPClIXkW5ghvAvsNuVSA8k+gCONcUCS/UjLEYvYps+e8uBtfgXgvhwfNug== + dependencies: + "@types/express" "*" + +"@types/serve-static@*", "@types/serve-static@^1.13.10": + version "1.15.5" + resolved "https://registry.npmjs.org/@types/serve-static/-/serve-static-1.15.5.tgz#15e67500ec40789a1e8c9defc2d32a896f05b033" + integrity sha512-PDRk21MnK70hja/YF8AHfC7yIsiQHn1rcXx7ijCFBX/k+XQJhQT/gw3xekXKJvx+5SXaMMS8oqQy09Mzvz2TuQ== + dependencies: + "@types/http-errors" "*" + "@types/mime" "*" + "@types/node" "*" + +"@types/sockjs@^0.3.33": + version "0.3.36" + resolved "https://registry.npmjs.org/@types/sockjs/-/sockjs-0.3.36.tgz#ce322cf07bcc119d4cbf7f88954f3a3bd0f67535" + integrity sha512-MK9V6NzAS1+Ud7JV9lJLFqW85VbC9dq3LmwZCuBe4wBDgKC0Kj/jd8Xl+nSviU+Qc3+m7umHHyHg//2KSa0a0Q== + dependencies: + "@types/node" "*" + +"@types/ws@^8.5.1": + version "8.5.10" + resolved "https://registry.npmjs.org/@types/ws/-/ws-8.5.10.tgz#4acfb517970853fa6574a3a6886791d04a396787" + integrity sha512-vmQSUcfalpIq0R9q7uTo2lXs6eGIpt9wtnLdMv9LVpIjCA/+ufZRozlVoVelIYixx1ugCBKDhn89vnsEGOCx9A== + dependencies: + "@types/node" "*" + "@webassemblyjs/ast@1.11.6", "@webassemblyjs/ast@^1.11.5": version "1.11.6" resolved "https://registry.yarnpkg.com/@webassemblyjs/ast/-/ast-1.11.6.tgz#db046555d3c413f8966ca50a95176a0e2c642e24" @@ -253,7 +390,7 @@ abab@^2.0.6: resolved "https://registry.yarnpkg.com/abab/-/abab-2.0.6.tgz#41b80f2c871d19686216b82309231cfd3cb3d291" integrity sha512-j2afSsaIENvHZN2B8GOpF566vZ5WVk5opAiMTvWgaQT8DkbOqsTfvNAvHoRGU2zzP8cPoqys+xHTRDWW8L+/BA== -accepts@~1.3.4: +accepts@~1.3.4, accepts@~1.3.5, accepts@~1.3.8: version "1.3.8" resolved "https://registry.yarnpkg.com/accepts/-/accepts-1.3.8.tgz#0bf0be125b67014adcb0b0921e62db7bffe16b2e" integrity sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw== @@ -271,11 +408,25 @@ acorn@^8.7.1, acorn@^8.8.2: resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.11.2.tgz#ca0d78b51895be5390a5903c5b3bdcdaf78ae40b" integrity sha512-nc0Axzp/0FILLEVsm4fNwLCwMttvhEI263QtVPQcbpfZZ3ts0hLsZGOpE6czNlid7CJ9MlyH8reXkpsf3YUY4w== +ajv-formats@^2.1.1: + version "2.1.1" + resolved "https://registry.npmjs.org/ajv-formats/-/ajv-formats-2.1.1.tgz#6e669400659eb74973bbf2e33327180a0996b520" + integrity sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA== + dependencies: + ajv "^8.0.0" + ajv-keywords@^3.5.2: version "3.5.2" resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-3.5.2.tgz#31f29da5ab6e00d1c2d329acf7b5929614d5014d" integrity sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ== +ajv-keywords@^5.1.0: + version "5.1.0" + resolved "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-5.1.0.tgz#69d4d385a4733cdbeab44964a1170a88f87f0e16" + integrity sha512-YCS/JNFAUyr5vAuhk1DWm1CBxRHW9LbJ2ozWeemrIqpbsqKjHVxYPyi5GC0rjZIT5JxJ3virVTS8wk4i/Z+krw== + dependencies: + fast-deep-equal "^3.1.3" + ajv@^6.12.5: version "6.12.6" resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.12.6.tgz#baf5a62e802b07d977034586f8c3baf5adf26df4" @@ -286,11 +437,26 @@ ajv@^6.12.5: json-schema-traverse "^0.4.1" uri-js "^4.2.2" +ajv@^8.0.0, ajv@^8.9.0: + version "8.12.0" + resolved "https://registry.npmjs.org/ajv/-/ajv-8.12.0.tgz#d1a0527323e22f53562c567c00991577dfbe19d1" + integrity sha512-sRu1kpcO9yLtYxBKvqfTeh9KzZEwO3STyX1HT+4CaDzC6HpTGYhIhPIzj9XuKU7KYDwnaeh5hcOwjy1QuJzBPA== + dependencies: + fast-deep-equal "^3.1.1" + json-schema-traverse "^1.0.0" + require-from-string "^2.0.2" + uri-js "^4.2.2" + ansi-colors@4.1.1: version "4.1.1" resolved "https://registry.yarnpkg.com/ansi-colors/-/ansi-colors-4.1.1.tgz#cbb9ae256bf750af1eab344f229aa27fe94ba348" integrity sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA== +ansi-html-community@^0.0.8: + version "0.0.8" + resolved "https://registry.npmjs.org/ansi-html-community/-/ansi-html-community-0.0.8.tgz#69fbc4d6ccbe383f9736934ae34c3f8290f1bf41" + integrity sha512-1APHAyr3+PCamwNw3bXCPp4HFLONZt/yIH0sZp0/469KWNTEy+qN5jQ3GVX6DMZ1UXAi34yVwtTeaG/HpBuuzw== + ansi-regex@^5.0.1: version "5.0.1" resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.1.tgz#082cb2c89c9fe8659a311a53bd6a4dc5301db304" @@ -316,6 +482,11 @@ argparse@^2.0.1: resolved "https://registry.yarnpkg.com/argparse/-/argparse-2.0.1.tgz#246f50f3ca78a3240f6c997e8a9bd1eac49e4b38" integrity sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q== +array-flatten@1.1.1: + version "1.1.1" + resolved "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz#9a5f699051b1e7073328f2a008968b64ea2955d2" + integrity sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg== + balanced-match@^1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee" @@ -326,11 +497,34 @@ base64id@2.0.0, base64id@~2.0.0: resolved "https://registry.yarnpkg.com/base64id/-/base64id-2.0.0.tgz#2770ac6bc47d312af97a8bf9a634342e0cd25cb6" integrity sha512-lGe34o6EHj9y3Kts9R4ZYs/Gr+6N7MCaMlIFA3F1R2O5/m7K06AxfSeO5530PEERE6/WyEg3lsuyw4GHlPZHog== +batch@0.6.1: + version "0.6.1" + resolved "https://registry.npmjs.org/batch/-/batch-0.6.1.tgz#dc34314f4e679318093fc760272525f94bf25c16" + integrity sha512-x+VAiMRL6UPkx+kudNvxTl6hB2XNNCG2r+7wixVfIYwu/2HKRXimwQyaumLjMveWvT2Hkd/cAJw+QBMfJ/EKVw== + binary-extensions@^2.0.0: version "2.2.0" resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-2.2.0.tgz#75f502eeaf9ffde42fc98829645be4ea76bd9e2d" integrity sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA== +body-parser@1.20.1: + version "1.20.1" + resolved "https://registry.npmjs.org/body-parser/-/body-parser-1.20.1.tgz#b1812a8912c195cd371a3ee5e66faa2338a5c668" + integrity sha512-jWi7abTbYwajOytWCQc37VulmWiRae5RyTpaCyDcS5/lMdtwSz5lOpDE67srw/HYe35f1z3fDQw+3txg7gNtWw== + dependencies: + bytes "3.1.2" + content-type "~1.0.4" + debug "2.6.9" + depd "2.0.0" + destroy "1.2.0" + http-errors "2.0.0" + iconv-lite "0.4.24" + on-finished "2.4.1" + qs "6.11.0" + raw-body "2.5.1" + type-is "~1.6.18" + unpipe "1.0.0" + body-parser@^1.19.0: version "1.20.2" resolved "https://registry.yarnpkg.com/body-parser/-/body-parser-1.20.2.tgz#6feb0e21c4724d06de7ff38da36dad4f57a747fd" @@ -349,6 +543,14 @@ body-parser@^1.19.0: type-is "~1.6.18" unpipe "1.0.0" +bonjour-service@^1.0.11: + version "1.2.1" + resolved "https://registry.npmjs.org/bonjour-service/-/bonjour-service-1.2.1.tgz#eb41b3085183df3321da1264719fbada12478d02" + integrity sha512-oSzCS2zV14bh2kji6vNe7vrpJYCHGvcZnlffFQ1MEoX/WOeQ/teD8SYWKR942OI3INjq8OMNJlbPK5LLLUxFDw== + dependencies: + fast-deep-equal "^3.1.3" + multicast-dns "^7.2.5" + brace-expansion@^1.1.7: version "1.1.11" resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" @@ -391,6 +593,11 @@ buffer-from@^1.0.0: resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.2.tgz#2b146a6fd72e80b4f55d255f35ed59a3a9a41bd5" integrity sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ== +bytes@3.0.0: + version "3.0.0" + resolved "https://registry.npmjs.org/bytes/-/bytes-3.0.0.tgz#d32815404d689699f85a4ea4fa8755dd13a96048" + integrity sha512-pMhOfFDPiv9t5jjIXkHosWmkSyQbvsgEVNkz0ERHbuLh2T/7j4Mqqpz523Fe8MVY89KC6Sh/QfS2sM+SjgFDcw== + bytes@3.1.2: version "3.1.2" resolved "https://registry.yarnpkg.com/bytes/-/bytes-3.1.2.tgz#8b0beeb98605adf1b128fa4386403c009e0221a5" @@ -423,7 +630,7 @@ chalk@^4.1.0: ansi-styles "^4.1.0" supports-color "^7.1.0" -chokidar@3.5.3, chokidar@^3.5.1: +chokidar@3.5.3, chokidar@^3.5.1, chokidar@^3.5.3: version "3.5.3" resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-3.5.3.tgz#1cf37c8707b932bd1af1ae22c0432e2acd1903bd" integrity sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw== @@ -473,7 +680,7 @@ color-name@~1.1.4: resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2" integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== -colorette@^2.0.14: +colorette@^2.0.10, colorette@^2.0.14: version "2.0.20" resolved "https://registry.yarnpkg.com/colorette/-/colorette-2.0.20.tgz#9eb793e6833067f7235902fcd3b09917a000a95a" integrity sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w== @@ -488,11 +695,36 @@ commander@^2.20.0: resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33" integrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ== +compressible@~2.0.16: + version "2.0.18" + resolved "https://registry.npmjs.org/compressible/-/compressible-2.0.18.tgz#af53cca6b070d4c3c0750fbd77286a6d7cc46fba" + integrity sha512-AF3r7P5dWxL8MxyITRMlORQNaOA2IkAFaTr4k7BUumjPtRpGDTZpl0Pb1XCO6JeDCBdp126Cgs9sMxqSjgYyRg== + dependencies: + mime-db ">= 1.43.0 < 2" + +compression@^1.7.4: + version "1.7.4" + resolved "https://registry.npmjs.org/compression/-/compression-1.7.4.tgz#95523eff170ca57c29a0ca41e6fe131f41e5bb8f" + integrity sha512-jaSIDzP9pZVS4ZfQ+TzvtiWhdpFhE2RDHz8QJkpX9SIpLq88VueF5jJw6t+6CUQcAoA6t+x89MLrWAqpfDE8iQ== + dependencies: + accepts "~1.3.5" + bytes "3.0.0" + compressible "~2.0.16" + debug "2.6.9" + on-headers "~1.0.2" + safe-buffer "5.1.2" + vary "~1.1.2" + concat-map@0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" integrity sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg== +connect-history-api-fallback@^2.0.0: + version "2.0.0" + resolved "https://registry.npmjs.org/connect-history-api-fallback/-/connect-history-api-fallback-2.0.0.tgz#647264845251a0daf25b97ce87834cace0f5f1c8" + integrity sha512-U73+6lQFmfiNPrYbXqr6kZ1i1wiRqXnp2nhMsINseWXO8lDau0LGEffJ8kQi4EjLZympVgRdvqjAgiZ1tgzDDA== + connect@^3.7.0: version "3.7.0" resolved "https://registry.yarnpkg.com/connect/-/connect-3.7.0.tgz#5d49348910caa5e07a01800b030d0c35f20484f8" @@ -503,16 +735,38 @@ connect@^3.7.0: parseurl "~1.3.3" utils-merge "1.0.1" -content-type@~1.0.5: +content-disposition@0.5.4: + version "0.5.4" + resolved "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz#8b82b4efac82512a02bb0b1dcec9d2c5e8eb5bfe" + integrity sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ== + dependencies: + safe-buffer "5.2.1" + +content-type@~1.0.4, content-type@~1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/content-type/-/content-type-1.0.5.tgz#8b773162656d1d1086784c8f23a54ce6d73d7918" integrity sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA== +cookie-signature@1.0.6: + version "1.0.6" + resolved "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz#e303a882b342cc3ee8ca513a79999734dab3ae2c" + integrity sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ== + +cookie@0.5.0: + version "0.5.0" + resolved "https://registry.npmjs.org/cookie/-/cookie-0.5.0.tgz#d1f5d71adec6558c58f389987c366aa47e994f8b" + integrity sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw== + cookie@~0.4.1: version "0.4.2" resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.4.2.tgz#0e41f24de5ecf317947c82fc789e06a884824432" integrity sha512-aSWTXFzaKWkvHO1Ny/s+ePFpvKsPnjc551iI41v3ny/ow6tBG5Vd+FuqGNhh1LxOmVzOlGUriIlOaokOvhaStA== +core-util-is@~1.0.0: + version "1.0.3" + resolved "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz#a6042d3634c2b27e9328f837b965fac83808db85" + integrity sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ== + cors@~2.8.5: version "2.8.5" resolved "https://registry.yarnpkg.com/cors/-/cors-2.8.5.tgz#eac11da51592dd86b9f06f6e7ac293b3df875d29" @@ -547,7 +801,7 @@ debug@2.6.9: dependencies: ms "2.0.0" -debug@4.3.4, debug@^4.3.4, debug@~4.3.1, debug@~4.3.2: +debug@4.3.4, debug@^4.1.0, debug@^4.3.4, debug@~4.3.1, debug@~4.3.2: version "4.3.4" resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.4.tgz#1319f6579357f2338d3337d2cdd4914bb5dcc865" integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ== @@ -559,6 +813,13 @@ decamelize@^4.0.0: resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-4.0.0.tgz#aa472d7bf660eb15f3494efd531cab7f2a709837" integrity sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ== +default-gateway@^6.0.3: + version "6.0.3" + resolved "https://registry.npmjs.org/default-gateway/-/default-gateway-6.0.3.tgz#819494c888053bdb743edbf343d6cdf7f2943a71" + integrity sha512-fwSOJsbbNzZ/CUFpqFBqYfYNLj1NbMPm8MMCIzHjC83iSJRBEGmDUxU+WP661BaBQImeC2yHwXtz+P/O9o+XEg== + dependencies: + execa "^5.0.0" + define-data-property@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/define-data-property/-/define-data-property-1.1.1.tgz#c35f7cd0ab09883480d12ac5cb213715587800b3" @@ -568,16 +829,31 @@ define-data-property@^1.1.1: gopd "^1.0.1" has-property-descriptors "^1.0.0" +define-lazy-prop@^2.0.0: + version "2.0.0" + resolved "https://registry.npmjs.org/define-lazy-prop/-/define-lazy-prop-2.0.0.tgz#3f7ae421129bcaaac9bc74905c98a0009ec9ee7f" + integrity sha512-Ds09qNh8yw3khSjiJjiUInaGX9xlqZDY7JVryGxdxV7NPeuqQfplOpQ66yJFZut3jLa5zOwkXw1g9EI2uKh4Og== + depd@2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/depd/-/depd-2.0.0.tgz#b696163cc757560d09cf22cc8fad1571b79e76df" integrity sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw== +depd@~1.1.2: + version "1.1.2" + resolved "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz#9bcd52e14c097763e749b274c4346ed2e560b5a9" + integrity sha512-7emPTl6Dpo6JRXOXjLRxck+FlLRX5847cLKEn00PLAgc3g2hTZZgr+e4c2v6QpSmLeFP3n5yUo7ft6avBK/5jQ== + destroy@1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/destroy/-/destroy-1.2.0.tgz#4803735509ad8be552934c67df614f94e66fa015" integrity sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg== +detect-node@^2.0.4: + version "2.1.0" + resolved "https://registry.npmjs.org/detect-node/-/detect-node-2.1.0.tgz#c9c70775a49c3d03bc2c06d9a73be550f978f8b1" + integrity sha512-T0NIuQpnTvFDATNuHN5roPwSBG83rFsuO+MXXH9/3N1eFbn4wcPjttvjMLEPWJ0RGUYgQE7cGgS3tNxbqCGM7g== + di@^0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/di/-/di-0.0.1.tgz#806649326ceaa7caa3306d75d985ea2748ba913c" @@ -588,6 +864,13 @@ diff@5.0.0: resolved "https://registry.yarnpkg.com/diff/-/diff-5.0.0.tgz#7ed6ad76d859d030787ec35855f5b1daf31d852b" integrity sha512-/VTCrvm5Z0JGty/BWHljh+BAiw3IK+2j87NGMu8Nwc/f48WoDAC395uomO9ZD117ZOBaHmkX1oyLvkVM/aIT3w== +dns-packet@^5.2.2: + version "5.6.1" + resolved "https://registry.npmjs.org/dns-packet/-/dns-packet-5.6.1.tgz#ae888ad425a9d1478a0674256ab866de1012cf2f" + integrity sha512-l4gcSouhcgIKRvyy99RNVOgxXiicE+2jZoNmaNmZ6JXiGajBOJAesk1OBlJuM5k2c+eudGdLxDqXuPCKIj6kpw== + dependencies: + "@leichtgewicht/ip-codec" "^2.0.1" + dom-serialize@^2.2.1: version "2.2.1" resolved "https://registry.yarnpkg.com/dom-serialize/-/dom-serialize-2.2.1.tgz#562ae8999f44be5ea3076f5419dcd59eb43ac95b" @@ -702,6 +985,11 @@ estraverse@^5.2.0: resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-5.3.0.tgz#2eea5290702f26ab8fe5370370ff86c965d21123" integrity sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA== +etag@~1.8.1: + version "1.8.1" + resolved "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz#41ae2eeb65efa62268aebfea83ac7d79299b0887" + integrity sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg== + eventemitter3@^4.0.0: version "4.0.7" resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-4.0.7.tgz#2de9b68f6528d5644ef5c59526a1b4a07306169f" @@ -712,12 +1000,64 @@ events@^3.2.0: resolved "https://registry.yarnpkg.com/events/-/events-3.3.0.tgz#31a95ad0a924e2d2c419a813aeb2c4e878ea7400" integrity sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q== +execa@^5.0.0: + version "5.1.1" + resolved "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz#f80ad9cbf4298f7bd1d4c9555c21e93741c411dd" + integrity sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg== + dependencies: + cross-spawn "^7.0.3" + get-stream "^6.0.0" + human-signals "^2.1.0" + is-stream "^2.0.0" + merge-stream "^2.0.0" + npm-run-path "^4.0.1" + onetime "^5.1.2" + signal-exit "^3.0.3" + strip-final-newline "^2.0.0" + +express@^4.17.3: + version "4.18.2" + resolved "https://registry.npmjs.org/express/-/express-4.18.2.tgz#3fabe08296e930c796c19e3c516979386ba9fd59" + integrity sha512-5/PsL6iGPdfQ/lKM1UuielYgv3BUoJfz1aUwU9vHZ+J7gyvwdQXFEBIEIaxeGf0GIcreATNyBExtalisDbuMqQ== + dependencies: + accepts "~1.3.8" + array-flatten "1.1.1" + body-parser "1.20.1" + content-disposition "0.5.4" + content-type "~1.0.4" + cookie "0.5.0" + cookie-signature "1.0.6" + debug "2.6.9" + depd "2.0.0" + encodeurl "~1.0.2" + escape-html "~1.0.3" + etag "~1.8.1" + finalhandler "1.2.0" + fresh "0.5.2" + http-errors "2.0.0" + merge-descriptors "1.0.1" + methods "~1.1.2" + on-finished "2.4.1" + parseurl "~1.3.3" + path-to-regexp "0.1.7" + proxy-addr "~2.0.7" + qs "6.11.0" + range-parser "~1.2.1" + safe-buffer "5.2.1" + send "0.18.0" + serve-static "1.15.0" + setprototypeof "1.2.0" + statuses "2.0.1" + type-is "~1.6.18" + utils-merge "1.0.1" + vary "~1.1.2" + extend@^3.0.0: version "3.0.2" resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.2.tgz#f8b1136b4071fbd8eb140aff858b1019ec2915fa" integrity sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g== -fast-deep-equal@^3.1.1: +fast-deep-equal@^3.1.1, fast-deep-equal@^3.1.3: version "3.1.3" resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525" integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q== @@ -732,6 +1072,13 @@ fastest-levenshtein@^1.0.12: resolved "https://registry.yarnpkg.com/fastest-levenshtein/-/fastest-levenshtein-1.0.16.tgz#210e61b6ff181de91ea9b3d1b84fdedd47e034e5" integrity sha512-eRnCtTTtGZFpQCwhJiUOuxPQWRXVKYDn0b2PeHfXL6/Zi53SLAzAHfVhVWK2AryC/WH05kGfxhFIPvTF0SXQzg== +faye-websocket@^0.11.3: + version "0.11.4" + resolved "https://registry.npmjs.org/faye-websocket/-/faye-websocket-0.11.4.tgz#7f0d9275cfdd86a1c963dc8b65fcc451edcbb1da" + integrity sha512-CzbClwlXAuiRQAlUyfqPgvPoNKTckTPGfwZV4ZdAhVcP2lh9KUxJg2b5GkE7XbjKQ3YJnQ9z6D9ntLAlB+tP8g== + dependencies: + websocket-driver ">=0.5.1" + fill-range@^7.0.1: version "7.0.1" resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.0.1.tgz#1919a6a7c75fe38b2c7c77e5198535da9acdda40" @@ -752,6 +1099,19 @@ finalhandler@1.1.2: statuses "~1.5.0" unpipe "~1.0.0" +finalhandler@1.2.0: + version "1.2.0" + resolved "https://registry.npmjs.org/finalhandler/-/finalhandler-1.2.0.tgz#7d23fe5731b207b4640e4fcd00aec1f9207a7b32" + integrity sha512-5uXcUVftlQMFnWC9qu/svkWv3GTd2PfUhK/3PLkYNAe7FbqJMt3515HaxE6eRL74GdsriiwujiawdaB1BpEISg== + dependencies: + debug "2.6.9" + encodeurl "~1.0.2" + escape-html "~1.0.3" + on-finished "2.4.1" + parseurl "~1.3.3" + statuses "2.0.1" + unpipe "~1.0.0" + find-up@5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/find-up/-/find-up-5.0.0.tgz#4c92819ecb7083561e4f4a240a86be5198f536fc" @@ -788,6 +1148,16 @@ format-util@^1.0.5: resolved "https://registry.yarnpkg.com/format-util/-/format-util-1.0.5.tgz#1ffb450c8a03e7bccffe40643180918cc297d271" integrity sha512-varLbTj0e0yVyRpqQhuWV+8hlePAgaoFRhNFj50BNjEIrw1/DphHSObtqwskVCPWNgzwPoQrZAbfa/SBiicNeg== +forwarded@0.2.0: + version "0.2.0" + resolved "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz#2269936428aad4c15c7ebe9779a84bf0b2a81811" + integrity sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow== + +fresh@0.5.2: + version "0.5.2" + resolved "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz#3d8cadd90d976569fa835ab1f8e4b23a105605a7" + integrity sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q== + fs-extra@^8.1.0: version "8.1.0" resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-8.1.0.tgz#49d43c45a88cd9677668cb7be1b46efdb8d2e1c0" @@ -797,6 +1167,11 @@ fs-extra@^8.1.0: jsonfile "^4.0.0" universalify "^0.1.0" +fs-monkey@^1.0.4: + version "1.0.5" + resolved "https://registry.npmjs.org/fs-monkey/-/fs-monkey-1.0.5.tgz#fe450175f0db0d7ea758102e1d84096acb925788" + integrity sha512-8uMbBjrhzW76TYgEV27Y5E//W2f/lTFmx78P2w19FZSxarhI/798APGQyuGCwmkNxgwGRhrLfvWyLBvNtuOmew== + fs.realpath@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" @@ -827,6 +1202,11 @@ get-intrinsic@^1.0.2, get-intrinsic@^1.1.3, get-intrinsic@^1.2.1, get-intrinsic@ has-symbols "^1.0.3" hasown "^2.0.0" +get-stream@^6.0.0: + version "6.0.1" + resolved "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz#a262d8eef67aced57c2852ad6167526a43cbf7b7" + integrity sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg== + glob-parent@~5.1.2: version "5.1.2" resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.2.tgz#869832c58034fe68a4093c17dc15e8340d8401c4" @@ -875,6 +1255,11 @@ graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.2.0, graceful-fs@^4.2.10, resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.11.tgz#4183e4e8bf08bb6e05bbb2f7d2e0c8f712ca40e3" integrity sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ== +handle-thing@^2.0.0: + version "2.0.1" + resolved "https://registry.npmjs.org/handle-thing/-/handle-thing-2.0.1.tgz#857f79ce359580c340d43081cc648970d0bb234e" + integrity sha512-9Qn4yBxelxoh2Ow62nP+Ka/kMnOXRi8BXnRaUwezLNhqelnN49xKz4F/dPP8OYLxLxq6JDtZb2i9XznUQbNPTg== + has-flag@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-4.0.0.tgz#944771fd9c81c81265c4d6941860da06bb59479b" @@ -909,6 +1294,26 @@ he@1.2.0: resolved "https://registry.yarnpkg.com/he/-/he-1.2.0.tgz#84ae65fa7eafb165fddb61566ae14baf05664f0f" integrity sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw== +hpack.js@^2.1.6: + version "2.1.6" + resolved "https://registry.npmjs.org/hpack.js/-/hpack.js-2.1.6.tgz#87774c0949e513f42e84575b3c45681fade2a0b2" + integrity sha512-zJxVehUdMGIKsRaNt7apO2Gqp0BdqW5yaiGHXXmbpvxgBYVZnAql+BJb4RO5ad2MgpbZKn5G6nMnegrH1FcNYQ== + dependencies: + inherits "^2.0.1" + obuf "^1.0.0" + readable-stream "^2.0.1" + wbuf "^1.1.0" + +html-entities@^2.3.2: + version "2.4.0" + resolved "https://registry.npmjs.org/html-entities/-/html-entities-2.4.0.tgz#edd0cee70402584c8c76cc2c0556db09d1f45061" + integrity sha512-igBTJcNNNhvZFRtm8uA6xMY6xYleeDwn3PeBCkDz7tHttv4F2hsDI2aPgNERWzvRcNYHNT3ymRaQzllmXj4YsQ== + +http-deceiver@^1.2.7: + version "1.2.7" + resolved "https://registry.npmjs.org/http-deceiver/-/http-deceiver-1.2.7.tgz#fa7168944ab9a519d337cb0bec7284dc3e723d87" + integrity sha512-LmpOGxTfbpgtGVxJrj5k7asXHCgNZp5nLfp+hWc8QQRqtb7fUy6kRY3BO1h9ddF6yIPYUARgxGOwB42DnxIaNw== + http-errors@2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/http-errors/-/http-errors-2.0.0.tgz#b7774a1486ef73cf7667ac9ae0858c012c57b9d3" @@ -920,6 +1325,32 @@ http-errors@2.0.0: statuses "2.0.1" toidentifier "1.0.1" +http-errors@~1.6.2: + version "1.6.3" + resolved "https://registry.npmjs.org/http-errors/-/http-errors-1.6.3.tgz#8b55680bb4be283a0b5bf4ea2e38580be1d9320d" + integrity sha512-lks+lVC8dgGyh97jxvxeYTWQFvh4uw4yC12gVl63Cg30sjPX4wuGcdkICVXDAESr6OJGjqGA8Iz5mkeN6zlD7A== + dependencies: + depd "~1.1.2" + inherits "2.0.3" + setprototypeof "1.1.0" + statuses ">= 1.4.0 < 2" + +http-parser-js@>=0.5.1: + version "0.5.8" + resolved "https://registry.npmjs.org/http-parser-js/-/http-parser-js-0.5.8.tgz#af23090d9ac4e24573de6f6aecc9d84a48bf20e3" + integrity sha512-SGeBX54F94Wgu5RH3X5jsDtf4eHyRogWX1XGT3b4HuW3tQPM4AaBzoUji/4AAJNXCEOWZ5O0DgZmJw1947gD5Q== + +http-proxy-middleware@^2.0.3: + version "2.0.6" + resolved "https://registry.npmjs.org/http-proxy-middleware/-/http-proxy-middleware-2.0.6.tgz#e1a4dd6979572c7ab5a4e4b55095d1f32a74963f" + integrity sha512-ya/UeJ6HVBYxrgYotAZo1KvPWlgB48kUJLDePFeneHsVujFaW5WNj2NgWCAE//B1Dl02BIfYlpNgBy8Kf8Rjmw== + dependencies: + "@types/http-proxy" "^1.17.8" + http-proxy "^1.18.1" + is-glob "^4.0.1" + is-plain-obj "^3.0.0" + micromatch "^4.0.2" + http-proxy@^1.18.1: version "1.18.1" resolved "https://registry.yarnpkg.com/http-proxy/-/http-proxy-1.18.1.tgz#401541f0534884bbf95260334e72f88ee3976549" @@ -929,6 +1360,11 @@ http-proxy@^1.18.1: follow-redirects "^1.0.0" requires-port "^1.0.0" +human-signals@^2.1.0: + version "2.1.0" + resolved "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz#dc91fcba42e4d06e4abaed33b3e7a3c02f514ea0" + integrity sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw== + iconv-lite@0.4.24: version "0.4.24" resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b" @@ -959,16 +1395,31 @@ inflight@^1.0.4: once "^1.3.0" wrappy "1" -inherits@2, inherits@2.0.4: +inherits@2, inherits@2.0.4, inherits@^2.0.1, inherits@^2.0.3, inherits@~2.0.3: version "2.0.4" resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== +inherits@2.0.3: + version "2.0.3" + resolved "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" + integrity sha512-x00IRNXNy63jwGkJmzPigoySHbaqpNuzKbBOmzK+g2OdZpQ9w+sxCN+VSB3ja7IAge2OP2qpfxTjeNcyjmW1uw== + interpret@^3.1.1: version "3.1.1" resolved "https://registry.yarnpkg.com/interpret/-/interpret-3.1.1.tgz#5be0ceed67ca79c6c4bc5cf0d7ee843dcea110c4" integrity sha512-6xwYfHbajpoF0xLW+iwLkhwgvLoZDfjYfoFNu8ftMoXINzwuymNLd9u/KmwtdT2GbR+/Cz66otEGEVVUHX9QLQ== +ipaddr.js@1.9.1: + version "1.9.1" + resolved "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz#bff38543eeb8984825079ff3a2a8e6cbd46781b3" + integrity sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g== + +ipaddr.js@^2.0.1: + version "2.1.0" + resolved "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-2.1.0.tgz#2119bc447ff8c257753b196fc5f1ce08a4cdf39f" + integrity sha512-LlbxQ7xKzfBusov6UMi4MFpEg0m+mAm9xyNGEduwXMEDuf4WfzB/RZwMVYEd7IKGvh4IUkEXYxtAVu9T3OelJQ== + is-binary-path@~2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/is-binary-path/-/is-binary-path-2.1.0.tgz#ea1f7f3b80f064236e83470f86c09c254fb45b09" @@ -983,6 +1434,11 @@ is-core-module@^2.13.0: dependencies: hasown "^2.0.0" +is-docker@^2.0.0, is-docker@^2.1.1: + version "2.2.1" + resolved "https://registry.npmjs.org/is-docker/-/is-docker-2.2.1.tgz#33eeabe23cfe86f14bde4408a02c0cfb853acdaa" + integrity sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ== + is-extglob@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2" @@ -1010,6 +1466,11 @@ is-plain-obj@^2.1.0: resolved "https://registry.yarnpkg.com/is-plain-obj/-/is-plain-obj-2.1.0.tgz#45e42e37fccf1f40da8e5f76ee21515840c09287" integrity sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA== +is-plain-obj@^3.0.0: + version "3.0.0" + resolved "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-3.0.0.tgz#af6f2ea14ac5a646183a5bbdb5baabbc156ad9d7" + integrity sha512-gwsOE28k+23GP1B6vFl1oVh/WOzmawBrKwo5Ev6wMKzPkaXaCDIQKzLnvsA42DRlbVTWorkgTKIviAKCWkfUwA== + is-plain-object@^2.0.4: version "2.0.4" resolved "https://registry.yarnpkg.com/is-plain-object/-/is-plain-object-2.0.4.tgz#2c163b3fafb1b606d9d17928f05c2a1c38e07677" @@ -1017,11 +1478,28 @@ is-plain-object@^2.0.4: dependencies: isobject "^3.0.1" +is-stream@^2.0.0: + version "2.0.1" + resolved "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz#fac1e3d53b97ad5a9d0ae9cef2389f5810a5c077" + integrity sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg== + is-unicode-supported@^0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz#3f26c76a809593b52bfa2ecb5710ed2779b522a7" integrity sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw== +is-wsl@^2.2.0: + version "2.2.0" + resolved "https://registry.npmjs.org/is-wsl/-/is-wsl-2.2.0.tgz#74a4c76e77ca9fd3f932f290c17ea326cd157271" + integrity sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww== + dependencies: + is-docker "^2.0.0" + +isarray@~1.0.0: + version "1.0.0" + resolved "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" + integrity sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ== + isbinaryfile@^4.0.8: version "4.0.10" resolved "https://registry.yarnpkg.com/isbinaryfile/-/isbinaryfile-4.0.10.tgz#0c5b5e30c2557a2f06febd37b7322946aaee42b3" @@ -1063,6 +1541,11 @@ json-schema-traverse@^0.4.1: resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz#69f6a87d9513ab8bb8fe63bdb0979c448e684660" integrity sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg== +json-schema-traverse@^1.0.0: + version "1.0.0" + resolved "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz#ae7bcb3656ab77a73ba5c49bf654f38e6b6860e2" + integrity sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug== + jsonfile@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-4.0.0.tgz#8771aae0799b64076b76640fca058f9c10e33ecb" @@ -1135,6 +1618,14 @@ kind-of@^6.0.2: resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-6.0.3.tgz#07c05034a6c349fa06e24fa35aa76db4580ce4dd" integrity sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw== +launch-editor@^2.6.0: + version "2.6.1" + resolved "https://registry.npmjs.org/launch-editor/-/launch-editor-2.6.1.tgz#f259c9ef95cbc9425620bbbd14b468fcdb4ffe3c" + integrity sha512-eB/uXmFVpY4zezmGp5XtU21kwo7GBbKB+EQ+UZeWtGb9yAM5xt/Evk+lYH3eRNAtId+ej4u7TYPFZ07w4s7rRw== + dependencies: + picocolors "^1.0.0" + shell-quote "^1.8.1" + loader-runner@^4.2.0: version "4.3.0" resolved "https://registry.yarnpkg.com/loader-runner/-/loader-runner-4.3.0.tgz#c1b4a163b99f614830353b16755e7149ac2314e1" @@ -1183,28 +1674,68 @@ media-typer@0.3.0: resolved "https://registry.yarnpkg.com/media-typer/-/media-typer-0.3.0.tgz#8710d7af0aa626f8fffa1ce00168545263255748" integrity sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ== +memfs@^3.4.3: + version "3.6.0" + resolved "https://registry.npmjs.org/memfs/-/memfs-3.6.0.tgz#d7a2110f86f79dd950a8b6df6d57bc984aa185f6" + integrity sha512-EGowvkkgbMcIChjMTMkESFDbZeSh8xZ7kNSF0hAiAN4Jh6jgHCRS0Ga/+C8y6Au+oqpezRHCfPsmJ2+DwAgiwQ== + dependencies: + fs-monkey "^1.0.4" + +merge-descriptors@1.0.1: + version "1.0.1" + resolved "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz#b00aaa556dd8b44568150ec9d1b953f3f90cbb61" + integrity sha512-cCi6g3/Zr1iqQi6ySbseM1Xvooa98N0w31jzUYrXPX2xqObmFGHJ0tQ5u74H3mVh7wLouTseZyYIq39g8cNp1w== + merge-stream@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/merge-stream/-/merge-stream-2.0.0.tgz#52823629a14dd00c9770fb6ad47dc6310f2c1f60" integrity sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w== -mime-db@1.52.0: +methods@~1.1.2: + version "1.1.2" + resolved "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz#5529a4d67654134edcc5266656835b0f851afcee" + integrity sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w== + +micromatch@^4.0.2: + version "4.0.5" + resolved "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz#bc8999a7cbbf77cdc89f132f6e467051b49090c6" + integrity sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA== + dependencies: + braces "^3.0.2" + picomatch "^2.3.1" + +mime-db@1.52.0, "mime-db@>= 1.43.0 < 2": version "1.52.0" resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.52.0.tgz#bbabcdc02859f4987301c856e3387ce5ec43bf70" integrity sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg== -mime-types@^2.1.27, mime-types@~2.1.24, mime-types@~2.1.34: +mime-types@^2.1.27, mime-types@^2.1.31, mime-types@~2.1.17, mime-types@~2.1.24, mime-types@~2.1.34: version "2.1.35" resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.35.tgz#381a871b62a734450660ae3deee44813f70d959a" integrity sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw== dependencies: mime-db "1.52.0" +mime@1.6.0: + version "1.6.0" + resolved "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz#32cd9e5c64553bd58d19a568af452acff04981b1" + integrity sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg== + mime@^2.5.2: version "2.6.0" resolved "https://registry.yarnpkg.com/mime/-/mime-2.6.0.tgz#a2a682a95cd4d0cb1d6257e28f83da7e35800367" integrity sha512-USPkMeET31rOMiarsBNIHZKLGgvKc/LrjofAnBlOttf5ajRvqiRA8QsenbcooctK6d6Ts6aqZXBA+XbkKthiQg== +mimic-fn@^2.1.0: + version "2.1.0" + resolved "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz#7ed2c2ccccaf84d3ffcb7a69b57711fc2083401b" + integrity sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg== + +minimalistic-assert@^1.0.0: + version "1.0.1" + resolved "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz#2e194de044626d4a10e7f7fbc00ce73e83e4d5c7" + integrity sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A== + minimatch@5.0.1: version "5.0.1" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-5.0.1.tgz#fb9022f7528125187c92bd9e9b6366be1cf3415b" @@ -1273,6 +1804,14 @@ ms@2.1.3: resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2" integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA== +multicast-dns@^7.2.5: + version "7.2.5" + resolved "https://registry.npmjs.org/multicast-dns/-/multicast-dns-7.2.5.tgz#77eb46057f4d7adbd16d9290fa7299f6fa64cced" + integrity sha512-2eznPJP8z2BFLX50tf0LuODrpINqP1RVIm/CObbTcBRITQgmC/TjcREF1NeTBzIcR5XO/ukWo+YHOjBbFwIupg== + dependencies: + dns-packet "^5.2.2" + thunky "^1.0.2" + nanoid@3.3.3: version "3.3.3" resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.3.tgz#fd8e8b7aa761fe807dba2d1b98fb7241bb724a25" @@ -1288,6 +1827,11 @@ neo-async@^2.6.2: resolved "https://registry.yarnpkg.com/neo-async/-/neo-async-2.6.2.tgz#b4aafb93e3aeb2d8174ca53cf163ab7d7308305f" integrity sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw== +node-forge@^1: + version "1.3.1" + resolved "https://registry.npmjs.org/node-forge/-/node-forge-1.3.1.tgz#be8da2af243b2417d5f646a770663a92b7e9ded3" + integrity sha512-dPEtOeMvF9VMcYV/1Wb8CPoVAXtp6MKMlcbAt4ddqmGqUJ6fQZFXkNZNkNlfevtNkGtaSoXf/vNNNSvgrdXwtA== + node-releases@^2.0.14: version "2.0.14" resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-2.0.14.tgz#2ffb053bceb8b2be8495ece1ab6ce600c4461b0b" @@ -1298,6 +1842,13 @@ normalize-path@^3.0.0, normalize-path@~3.0.0: resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-3.0.0.tgz#0dcd69ff23a1c9b11fd0978316644a0388216a65" integrity sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA== +npm-run-path@^4.0.1: + version "4.0.1" + resolved "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz#b7ecd1e5ed53da8e37a55e1c2269e0b97ed748ea" + integrity sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw== + dependencies: + path-key "^3.0.0" + object-assign@^4: version "4.1.1" resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" @@ -1308,6 +1859,11 @@ object-inspect@^1.9.0: resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.13.1.tgz#b96c6109324ccfef6b12216a956ca4dc2ff94bc2" integrity sha512-5qoj1RUiKOMsCCNLV1CBiPYE10sziTsnmNxkAI/rZhiD63CF7IqdFGC/XzjWjpSgLf0LxXX3bDFIh0E18f6UhQ== +obuf@^1.0.0, obuf@^1.1.2: + version "1.1.2" + resolved "https://registry.npmjs.org/obuf/-/obuf-1.1.2.tgz#09bea3343d41859ebd446292d11c9d4db619084e" + integrity sha512-PX1wu0AmAdPqOL1mWhqmlOd8kOIZQwGZw6rh7uby9fTc5lhaOWFLX3I6R1hrF9k3zUY40e6igsLGkDXK92LJNg== + on-finished@2.4.1: version "2.4.1" resolved "https://registry.yarnpkg.com/on-finished/-/on-finished-2.4.1.tgz#58c8c44116e54845ad57f14ab10b03533184ac3f" @@ -1322,6 +1878,11 @@ on-finished@~2.3.0: dependencies: ee-first "1.1.1" +on-headers@~1.0.2: + version "1.0.2" + resolved "https://registry.npmjs.org/on-headers/-/on-headers-1.0.2.tgz#772b0ae6aaa525c399e489adfad90c403eb3c28f" + integrity sha512-pZAE+FJLoyITytdqK0U5s+FIpjN0JP3OzFi/u8Rx+EV5/W+JTWGXG8xFzevE7AjBfDqHv/8vL8qQsIhHnqRkrA== + once@^1.3.0: version "1.4.0" resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" @@ -1329,6 +1890,22 @@ once@^1.3.0: dependencies: wrappy "1" +onetime@^5.1.2: + version "5.1.2" + resolved "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz#d0e96ebb56b07476df1dd9c4806e5237985ca45e" + integrity sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg== + dependencies: + mimic-fn "^2.1.0" + +open@^8.0.9: + version "8.4.2" + resolved "https://registry.npmjs.org/open/-/open-8.4.2.tgz#5b5ffe2a8f793dcd2aad73e550cb87b59cb084f9" + integrity sha512-7x81NCL719oNbsq/3mh+hVrAWmFuEYUqrq/Iw3kUzH8ReypT9QQ0BLoJS7/G9k6N81XjW4qHWtjWwe/9eLy1EQ== + dependencies: + define-lazy-prop "^2.0.0" + is-docker "^2.1.1" + is-wsl "^2.2.0" + p-limit@^2.2.0: version "2.3.0" resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-2.3.0.tgz#3dd33c647a214fdfffd835933eb086da0dc21db1" @@ -1357,12 +1934,20 @@ p-locate@^5.0.0: dependencies: p-limit "^3.0.2" +p-retry@^4.5.0: + version "4.6.2" + resolved "https://registry.npmjs.org/p-retry/-/p-retry-4.6.2.tgz#9baae7184057edd4e17231cee04264106e092a16" + integrity sha512-312Id396EbJdvRONlngUx0NydfrIQ5lsYu0znKVUzVvArzEIt08V1qhtyESbGVd1FGX7UKtiFp5uwKZdM8wIuQ== + dependencies: + "@types/retry" "0.12.0" + retry "^0.13.1" + p-try@^2.0.0: version "2.2.0" resolved "https://registry.yarnpkg.com/p-try/-/p-try-2.2.0.tgz#cb2868540e313d61de58fafbe35ce9004d5540e6" integrity sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ== -parseurl@~1.3.3: +parseurl@~1.3.2, parseurl@~1.3.3: version "1.3.3" resolved "https://registry.yarnpkg.com/parseurl/-/parseurl-1.3.3.tgz#9da19e7bee8d12dff0513ed5b76957793bc2e8d4" integrity sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ== @@ -1377,7 +1962,7 @@ path-is-absolute@^1.0.0: resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" integrity sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg== -path-key@^3.1.0: +path-key@^3.0.0, path-key@^3.1.0: version "3.1.1" resolved "https://registry.yarnpkg.com/path-key/-/path-key-3.1.1.tgz#581f6ade658cbba65a0d3380de7753295054f375" integrity sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q== @@ -1387,12 +1972,17 @@ path-parse@^1.0.7: resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.7.tgz#fbc114b60ca42b30d9daf5858e4bd68bbedb6735" integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw== +path-to-regexp@0.1.7: + version "0.1.7" + resolved "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz#df604178005f522f15eb4490e7247a1bfaa67f8c" + integrity sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ== + picocolors@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.0.0.tgz#cb5bdc74ff3f51892236eaf79d68bc44564ab81c" integrity sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ== -picomatch@^2.0.4, picomatch@^2.2.1: +picomatch@^2.0.4, picomatch@^2.2.1, picomatch@^2.3.1: version "2.3.1" resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42" integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA== @@ -1404,6 +1994,19 @@ pkg-dir@^4.2.0: dependencies: find-up "^4.0.0" +process-nextick-args@~2.0.0: + version "2.0.1" + resolved "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz#7820d9b16120cc55ca9ae7792680ae7dba6d7fe2" + integrity sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag== + +proxy-addr@~2.0.7: + version "2.0.7" + resolved "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz#f19fe69ceab311eeb94b42e70e8c2070f9ba1025" + integrity sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg== + dependencies: + forwarded "0.2.0" + ipaddr.js "1.9.1" + punycode@^2.1.0: version "2.3.1" resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.3.1.tgz#027422e2faec0b25e1549c3e1bd8309b9133b6e5" @@ -1428,11 +2031,21 @@ randombytes@^2.1.0: dependencies: safe-buffer "^5.1.0" -range-parser@^1.2.1: +range-parser@^1.2.1, range-parser@~1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/range-parser/-/range-parser-1.2.1.tgz#3cf37023d199e1c24d1a55b84800c2f3e6468031" integrity sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg== +raw-body@2.5.1: + version "2.5.1" + resolved "https://registry.npmjs.org/raw-body/-/raw-body-2.5.1.tgz#fe1b1628b181b700215e5fd42389f98b71392857" + integrity sha512-qqJBtEyVgS0ZmPGdCFPWJ3FreoqvG4MVQln/kCgF7Olq95IbOp0/BWyMwbdtn4VTvkM8Y7khCQ2Xgk/tcrCXig== + dependencies: + bytes "3.1.2" + http-errors "2.0.0" + iconv-lite "0.4.24" + unpipe "1.0.0" + raw-body@2.5.2: version "2.5.2" resolved "https://registry.yarnpkg.com/raw-body/-/raw-body-2.5.2.tgz#99febd83b90e08975087e8f1f9419a149366b68a" @@ -1443,6 +2056,28 @@ raw-body@2.5.2: iconv-lite "0.4.24" unpipe "1.0.0" +readable-stream@^2.0.1: + version "2.3.8" + resolved "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz#91125e8042bba1b9887f49345f6277027ce8be9b" + integrity sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA== + dependencies: + core-util-is "~1.0.0" + inherits "~2.0.3" + isarray "~1.0.0" + process-nextick-args "~2.0.0" + safe-buffer "~5.1.1" + string_decoder "~1.1.1" + util-deprecate "~1.0.1" + +readable-stream@^3.0.6: + version "3.6.2" + resolved "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz#56a9b36ea965c00c5a93ef31eb111a0f11056967" + integrity sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA== + dependencies: + inherits "^2.0.3" + string_decoder "^1.1.1" + util-deprecate "^1.0.1" + readdirp@~3.6.0: version "3.6.0" resolved "https://registry.yarnpkg.com/readdirp/-/readdirp-3.6.0.tgz#74a370bd857116e245b29cc97340cd431a02a6c7" @@ -1462,6 +2097,11 @@ require-directory@^2.1.1: resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" integrity sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q== +require-from-string@^2.0.2: + version "2.0.2" + resolved "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz#89a7fdd938261267318eafe14f9c32e598c36909" + integrity sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw== + requires-port@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/requires-port/-/requires-port-1.0.0.tgz#925d2601d39ac485e091cf0da5c6e694dc3dcaff" @@ -1488,6 +2128,11 @@ resolve@^1.20.0: path-parse "^1.0.7" supports-preserve-symlinks-flag "^1.0.0" +retry@^0.13.1: + version "0.13.1" + resolved "https://registry.npmjs.org/retry/-/retry-0.13.1.tgz#185b1587acf67919d63b357349e03537b2484658" + integrity sha512-XQBQ3I8W1Cge0Seh+6gjj03LbmRFWuoszgK9ooCpwYIrhhoO80pfq4cUkU5DkknwfOfFteRwlZ56PYOGYyFWdg== + rfdc@^1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/rfdc/-/rfdc-1.3.0.tgz#d0b7c441ab2720d05dc4cf26e01c89631d9da08b" @@ -1500,7 +2145,12 @@ rimraf@^3.0.0, rimraf@^3.0.2: dependencies: glob "^7.1.3" -safe-buffer@^5.1.0: +safe-buffer@5.1.2, safe-buffer@~5.1.0, safe-buffer@~5.1.1: + version "5.1.2" + resolved "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d" + integrity sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g== + +safe-buffer@5.2.1, safe-buffer@>=5.1.0, safe-buffer@^5.1.0, safe-buffer@~5.2.0: version "5.2.1" resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== @@ -1519,6 +2169,48 @@ schema-utils@^3.1.1, schema-utils@^3.1.2: ajv "^6.12.5" ajv-keywords "^3.5.2" +schema-utils@^4.0.0: + version "4.2.0" + resolved "https://registry.npmjs.org/schema-utils/-/schema-utils-4.2.0.tgz#70d7c93e153a273a805801882ebd3bff20d89c8b" + integrity sha512-L0jRsrPpjdckP3oPug3/VxNKt2trR8TcabrM6FOAAlvC/9Phcmm+cuAgTlxBqdBR1WJx7Naj9WHw+aOmheSVbw== + dependencies: + "@types/json-schema" "^7.0.9" + ajv "^8.9.0" + ajv-formats "^2.1.1" + ajv-keywords "^5.1.0" + +select-hose@^2.0.0: + version "2.0.0" + resolved "https://registry.npmjs.org/select-hose/-/select-hose-2.0.0.tgz#625d8658f865af43ec962bfc376a37359a4994ca" + integrity sha512-mEugaLK+YfkijB4fx0e6kImuJdCIt2LxCRcbEYPqRGCs4F2ogyfZU5IAZRdjCP8JPq2AtdNoC/Dux63d9Kiryg== + +selfsigned@^2.1.1: + version "2.4.1" + resolved "https://registry.npmjs.org/selfsigned/-/selfsigned-2.4.1.tgz#560d90565442a3ed35b674034cec4e95dceb4ae0" + integrity sha512-th5B4L2U+eGLq1TVh7zNRGBapioSORUeymIydxgFpwww9d2qyKvtuPU2jJuHvYAwwqi2Y596QBL3eEqcPEYL8Q== + dependencies: + "@types/node-forge" "^1.3.0" + node-forge "^1" + +send@0.18.0: + version "0.18.0" + resolved "https://registry.npmjs.org/send/-/send-0.18.0.tgz#670167cc654b05f5aa4a767f9113bb371bc706be" + integrity sha512-qqWzuOjSFOuqPjFe4NOsMLafToQQwBSOEpS+FwEt3A2V3vKubTquT3vmLTQpFgMXp8AlFWFuP1qKaJZOtPpVXg== + dependencies: + debug "2.6.9" + depd "2.0.0" + destroy "1.2.0" + encodeurl "~1.0.2" + escape-html "~1.0.3" + etag "~1.8.1" + fresh "0.5.2" + http-errors "2.0.0" + mime "1.6.0" + ms "2.1.3" + on-finished "2.4.1" + range-parser "~1.2.1" + statuses "2.0.1" + serialize-javascript@6.0.0: version "6.0.0" resolved "https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-6.0.0.tgz#efae5d88f45d7924141da8b5c3a7a7e663fefeb8" @@ -1533,6 +2225,29 @@ serialize-javascript@^6.0.1: dependencies: randombytes "^2.1.0" +serve-index@^1.9.1: + version "1.9.1" + resolved "https://registry.npmjs.org/serve-index/-/serve-index-1.9.1.tgz#d3768d69b1e7d82e5ce050fff5b453bea12a9239" + integrity sha512-pXHfKNP4qujrtteMrSBb0rc8HJ9Ms/GrXwcUtUtD5s4ewDJI8bT3Cz2zTVRMKtri49pLx2e0Ya8ziP5Ya2pZZw== + dependencies: + accepts "~1.3.4" + batch "0.6.1" + debug "2.6.9" + escape-html "~1.0.3" + http-errors "~1.6.2" + mime-types "~2.1.17" + parseurl "~1.3.2" + +serve-static@1.15.0: + version "1.15.0" + resolved "https://registry.npmjs.org/serve-static/-/serve-static-1.15.0.tgz#faaef08cffe0a1a62f60cad0c4e513cff0ac9540" + integrity sha512-XGuRDNjXUijsUL0vl6nSD7cwURuzEgglbOaFuZM9g3kwDXOWVTck0jLzjPzGD+TazWbboZYu52/9/XPdUgne9g== + dependencies: + encodeurl "~1.0.2" + escape-html "~1.0.3" + parseurl "~1.3.3" + send "0.18.0" + set-function-length@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/set-function-length/-/set-function-length-1.1.1.tgz#4bc39fafb0307224a33e106a7d35ca1218d659ed" @@ -1543,6 +2258,11 @@ set-function-length@^1.1.1: gopd "^1.0.1" has-property-descriptors "^1.0.0" +setprototypeof@1.1.0: + version "1.1.0" + resolved "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.0.tgz#d0bd85536887b6fe7c0d818cb962d9d91c54e656" + integrity sha512-BvE/TwpZX4FXExxOxZyRGQQv651MSwmWKZGqvmPcRIjDqWub67kTKuIMx43cZZrS/cBBzwBcNDWoFxt2XEFIpQ== + setprototypeof@1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/setprototypeof/-/setprototypeof-1.2.0.tgz#66c9a24a73f9fc28cbe66b09fed3d33dcaf1b424" @@ -1567,6 +2287,11 @@ shebang-regex@^3.0.0: resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-3.0.0.tgz#ae16f1644d873ecad843b0307b143362d4c42172" integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A== +shell-quote@^1.8.1: + version "1.8.1" + resolved "https://registry.npmjs.org/shell-quote/-/shell-quote-1.8.1.tgz#6dbf4db75515ad5bac63b4f1894c3a154c766680" + integrity sha512-6j1W9l1iAs/4xYBI1SYOVZyFcCis9b4KCLQ8fgAGG07QvzaRLVVRQvAy85yNmmZSjYjg4MWh4gNvlPujU/5LpA== + side-channel@^1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/side-channel/-/side-channel-1.0.4.tgz#efce5c8fdc104ee751b25c58d4290011fa5ea2cf" @@ -1576,6 +2301,11 @@ side-channel@^1.0.4: get-intrinsic "^1.0.2" object-inspect "^1.9.0" +signal-exit@^3.0.3: + version "3.0.7" + resolved "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz#a9a1767f8af84155114eaabd73f99273c8f59ad9" + integrity sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ== + socket.io-adapter@~2.5.2: version "2.5.2" resolved "https://registry.yarnpkg.com/socket.io-adapter/-/socket.io-adapter-2.5.2.tgz#5de9477c9182fdc171cd8c8364b9a8894ec75d12" @@ -1604,6 +2334,15 @@ socket.io@^4.4.1: socket.io-adapter "~2.5.2" socket.io-parser "~4.2.4" +sockjs@^0.3.24: + version "0.3.24" + resolved "https://registry.npmjs.org/sockjs/-/sockjs-0.3.24.tgz#c9bc8995f33a111bea0395ec30aa3206bdb5ccce" + integrity sha512-GJgLTZ7vYb/JtPSSZ10hsOYIvEYsjbNU+zPdIHcUaWVNUEPivzxku31865sSSud0Da0W4lEeOPlmw93zLQchuQ== + dependencies: + faye-websocket "^0.11.3" + uuid "^8.3.2" + websocket-driver "^0.7.4" + source-map-js@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/source-map-js/-/source-map-js-1.0.2.tgz#adbc361d9c62df380125e7f161f71c826f1e490c" @@ -1631,12 +2370,35 @@ source-map@^0.6.0, source-map@^0.6.1: resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== +spdy-transport@^3.0.0: + version "3.0.0" + resolved "https://registry.npmjs.org/spdy-transport/-/spdy-transport-3.0.0.tgz#00d4863a6400ad75df93361a1608605e5dcdcf31" + integrity sha512-hsLVFE5SjA6TCisWeJXFKniGGOpBgMLmerfO2aCyCU5s7nJ/rpAepqmFifv/GCbSbueEeAJJnmSQ2rKC/g8Fcw== + dependencies: + debug "^4.1.0" + detect-node "^2.0.4" + hpack.js "^2.1.6" + obuf "^1.1.2" + readable-stream "^3.0.6" + wbuf "^1.7.3" + +spdy@^4.0.2: + version "4.0.2" + resolved "https://registry.npmjs.org/spdy/-/spdy-4.0.2.tgz#b74f466203a3eda452c02492b91fb9e84a27677b" + integrity sha512-r46gZQZQV+Kl9oItvl1JZZqJKGr+oEkB08A6BzkiR7593/7IbtuncXHd2YoYeTsG4157ZssMu9KYvUHLcjcDoA== + dependencies: + debug "^4.1.0" + handle-thing "^2.0.0" + http-deceiver "^1.2.7" + select-hose "^2.0.0" + spdy-transport "^3.0.0" + statuses@2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/statuses/-/statuses-2.0.1.tgz#55cb000ccf1d48728bd23c685a063998cf1a1b63" integrity sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ== -statuses@~1.5.0: +"statuses@>= 1.4.0 < 2", statuses@~1.5.0: version "1.5.0" resolved "https://registry.yarnpkg.com/statuses/-/statuses-1.5.0.tgz#161c7dac177659fd9811f43771fa99381478628c" integrity sha512-OpZ3zP+jT1PI7I8nemJX4AKmAX070ZkYPVWV/AaKTJl+tXCTGyVdC1a4SL8RUQYEwk/f34ZX8UTykN68FwrqAA== @@ -1659,6 +2421,20 @@ string-width@^4.1.0, string-width@^4.2.0: is-fullwidth-code-point "^3.0.0" strip-ansi "^6.0.1" +string_decoder@^1.1.1: + version "1.3.0" + resolved "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz#42f114594a46cf1a8e30b0a84f56c78c3edac21e" + integrity sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA== + dependencies: + safe-buffer "~5.2.0" + +string_decoder@~1.1.1: + version "1.1.1" + resolved "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz#9cf1611ba62685d7030ae9e4ba34149c3af03fc8" + integrity sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg== + dependencies: + safe-buffer "~5.1.0" + strip-ansi@^6.0.0, strip-ansi@^6.0.1: version "6.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" @@ -1666,6 +2442,11 @@ strip-ansi@^6.0.0, strip-ansi@^6.0.1: dependencies: ansi-regex "^5.0.1" +strip-final-newline@^2.0.0: + version "2.0.0" + resolved "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz#89b852fb2fcbe936f6f4b3187afb0a12c1ab58ad" + integrity sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA== + strip-json-comments@3.1.1: version "3.1.1" resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.1.1.tgz#31f1281b3832630434831c310c01cccda8cbe006" @@ -1716,6 +2497,11 @@ terser@^5.16.8: commander "^2.20.0" source-map-support "~0.5.20" +thunky@^1.0.2: + version "1.1.0" + resolved "https://registry.npmjs.org/thunky/-/thunky-1.1.0.tgz#5abaf714a9405db0504732bbccd2cedd9ef9537d" + integrity sha512-eHY7nBftgThBqOyHGVN+l8gF0BucP09fMo0oO/Lb0w1OF80dJv+lDVpXG60WMQvkcxAkNybKsrEIE3ZtKGmPrA== + tmp@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.2.1.tgz#8457fc3037dcf4719c251367a1af6500ee1ccf14" @@ -1783,12 +2569,22 @@ uri-js@^4.2.2: dependencies: punycode "^2.1.0" +util-deprecate@^1.0.1, util-deprecate@~1.0.1: + version "1.0.2" + resolved "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" + integrity sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw== + utils-merge@1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/utils-merge/-/utils-merge-1.0.1.tgz#9f95710f50a267947b2ccc124741c1028427e713" integrity sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA== -vary@^1: +uuid@^8.3.2: + version "8.3.2" + resolved "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz#80d5b5ced271bb9af6c445f21a1a04c606cefbe2" + integrity sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg== + +vary@^1, vary@~1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/vary/-/vary-1.1.2.tgz#2299f02c6ded30d4a5961b0b9f74524a18f634fc" integrity sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg== @@ -1806,6 +2602,13 @@ watchpack@^2.4.0: glob-to-regexp "^0.4.1" graceful-fs "^4.1.2" +wbuf@^1.1.0, wbuf@^1.7.3: + version "1.7.3" + resolved "https://registry.npmjs.org/wbuf/-/wbuf-1.7.3.tgz#c1d8d149316d3ea852848895cb6a0bfe887b87df" + integrity sha512-O84QOnr0icsbFGLS0O3bI5FswxzRr8/gHwWkDlQFskhSPryQXvrTMxjxGP4+iWYoauLoBvfDpkrOauZ+0iZpDA== + dependencies: + minimalistic-assert "^1.0.0" + webpack-cli@5.1.0: version "5.1.0" resolved "https://registry.yarnpkg.com/webpack-cli/-/webpack-cli-5.1.0.tgz#abc4b1f44b50250f2632d8b8b536cfe2f6257891" @@ -1825,6 +2628,53 @@ webpack-cli@5.1.0: rechoir "^0.8.0" webpack-merge "^5.7.3" +webpack-dev-middleware@^5.3.1: + version "5.3.3" + resolved "https://registry.npmjs.org/webpack-dev-middleware/-/webpack-dev-middleware-5.3.3.tgz#efae67c2793908e7311f1d9b06f2a08dcc97e51f" + integrity sha512-hj5CYrY0bZLB+eTO+x/j67Pkrquiy7kWepMHmUMoPsmcUaeEnQJqFzHJOyxgWlq746/wUuA64p9ta34Kyb01pA== + dependencies: + colorette "^2.0.10" + memfs "^3.4.3" + mime-types "^2.1.31" + range-parser "^1.2.1" + schema-utils "^4.0.0" + +webpack-dev-server@4.15.0: + version "4.15.0" + resolved "https://registry.npmjs.org/webpack-dev-server/-/webpack-dev-server-4.15.0.tgz#87ba9006eca53c551607ea0d663f4ae88be7af21" + integrity sha512-HmNB5QeSl1KpulTBQ8UT4FPrByYyaLxpJoQ0+s7EvUrMc16m0ZS1sgb1XGqzmgCPk0c9y+aaXxn11tbLzuM7NQ== + dependencies: + "@types/bonjour" "^3.5.9" + "@types/connect-history-api-fallback" "^1.3.5" + "@types/express" "^4.17.13" + "@types/serve-index" "^1.9.1" + "@types/serve-static" "^1.13.10" + "@types/sockjs" "^0.3.33" + "@types/ws" "^8.5.1" + ansi-html-community "^0.0.8" + bonjour-service "^1.0.11" + chokidar "^3.5.3" + colorette "^2.0.10" + compression "^1.7.4" + connect-history-api-fallback "^2.0.0" + default-gateway "^6.0.3" + express "^4.17.3" + graceful-fs "^4.2.6" + html-entities "^2.3.2" + http-proxy-middleware "^2.0.3" + ipaddr.js "^2.0.1" + launch-editor "^2.6.0" + open "^8.0.9" + p-retry "^4.5.0" + rimraf "^3.0.2" + schema-utils "^4.0.0" + selfsigned "^2.1.1" + serve-index "^1.9.1" + sockjs "^0.3.24" + spdy "^4.0.2" + webpack-dev-middleware "^5.3.1" + ws "^8.13.0" + webpack-merge@^4.1.5: version "4.2.2" resolved "https://registry.yarnpkg.com/webpack-merge/-/webpack-merge-4.2.2.tgz#a27c52ea783d1398afd2087f547d7b9d2f43634d" @@ -1876,6 +2726,20 @@ webpack@5.82.0: watchpack "^2.4.0" webpack-sources "^3.2.3" +websocket-driver@>=0.5.1, websocket-driver@^0.7.4: + version "0.7.4" + resolved "https://registry.npmjs.org/websocket-driver/-/websocket-driver-0.7.4.tgz#89ad5295bbf64b480abcba31e4953aca706f5760" + integrity sha512-b17KeDIQVjvb0ssuSDF2cYXSg2iztliJ4B9WdsuB6J952qCPKmnVq4DyW5motImXHDC1cBT/1UezrJVsKw5zjg== + dependencies: + http-parser-js ">=0.5.1" + safe-buffer ">=5.1.0" + websocket-extensions ">=0.1.1" + +websocket-extensions@>=0.1.1: + version "0.1.4" + resolved "https://registry.npmjs.org/websocket-extensions/-/websocket-extensions-0.1.4.tgz#7f8473bc839dfd87608adb95d7eb075211578a42" + integrity sha512-OqedPIGOfsDlo31UNwYbCFMSaO9m9G/0faIHj5/dZFDMFqPTcx6UwqyOy3COEaEOg/9VsGIpdqn62W5KhoKSpg== + which@^1.2.1: version "1.3.1" resolved "https://registry.yarnpkg.com/which/-/which-1.3.1.tgz#a45043d54f5805316da8d62f9f50918d3da70b0a" @@ -1914,6 +2778,11 @@ wrappy@1: resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" integrity sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ== +ws@^8.13.0: + version "8.16.0" + resolved "https://registry.npmjs.org/ws/-/ws-8.16.0.tgz#d1cd774f36fbc07165066a60e40323eab6446fd4" + integrity sha512-HS0c//TP7Ina87TfiPUz1rQzMhHrl/SG2guqRcTOIUYD2q8uhUdNHZYJUaQ8aTGPzCh+c6oawMKW35nFl1dxyQ== + ws@~8.11.0: version "8.11.0" resolved "https://registry.yarnpkg.com/ws/-/ws-8.11.0.tgz#6a0d36b8edfd9f96d8b25683db2f8d7de6e8e143" diff --git a/samples/sample-wasmJs/build.gradle.kts b/samples/sample-wasmJs/build.gradle.kts index b27866d..116caf7 100644 --- a/samples/sample-wasmJs/build.gradle.kts +++ b/samples/sample-wasmJs/build.gradle.kts @@ -23,7 +23,7 @@ buildscript { mavenCentral() } dependencies { - classpath("love.forte.plugin.suspend-transform:suspend-transform-plugin-gradle:0.6.0-local-test-1") + classpath("love.forte.plugin.suspend-transform:suspend-transform-plugin-gradle:0.7.0-dev1") } } diff --git a/settings.gradle.kts b/settings.gradle.kts index f7702be..781ff8e 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -28,6 +28,6 @@ include(":runtime:suspend-transform-runtime") include(":plugins:suspend-transform-plugin-gradle") //Samples -//include(":samples:sample-jvm") -//include(":samples:sample-js") -//include(":samples:sample-wasmJs") +include(":samples:sample-jvm") +include(":samples:sample-js") +include(":samples:sample-wasmJs") From c8aecf1937a12b94a6906766de06fcfeb9298d76 Mon Sep 17 00:00:00 2001 From: ForteScarlet Date: Thu, 25 Jan 2024 22:51:02 +0800 Subject: [PATCH 4/8] Support K2 --- .gitignore | 3 +- buildSrc/src/main/kotlin/IProject.kt | 2 +- .../suspend-transform-plugin/build.gradle.kts | 4 + .../ir/SuspendTransformTransformer.kt | 2 +- ...spendTransformerEnvironmentConfigurator.kt | 2 +- .../src/testData/codegen/asProperty.asm.txt | 83 ++++++ .../testData/codegen/asProperty.fir.ir.txt | 136 ++++++++++ .../src/testData/codegen/asProperty.fir.txt | 32 +++ .../src/testData/codegen/basic.asm.txt | 125 +++++++++ .../src/testData/codegen/basic.fir.ir.txt | 187 ++++++++++++++ .../src/testData/codegen/basic.fir.txt | 49 ++++ .../src/testData/codegen/override.asm.txt | 131 ++++++++++ .../src/testData/codegen/override.fir.ir.txt | 241 ++++++++++++++++++ .../src/testData/codegen/override.fir.txt | 53 ++++ .../src/testData/codegen/typeAttr.asm.txt | 65 +++++ .../src/testData/codegen/typeAttr.fir.ir.txt | 132 ++++++++++ .../src/testData/codegen/typeAttr.fir.txt | 31 +++ 17 files changed, 1274 insertions(+), 4 deletions(-) create mode 100644 compiler/suspend-transform-plugin/src/testData/codegen/asProperty.asm.txt create mode 100644 compiler/suspend-transform-plugin/src/testData/codegen/asProperty.fir.ir.txt create mode 100644 compiler/suspend-transform-plugin/src/testData/codegen/asProperty.fir.txt create mode 100644 compiler/suspend-transform-plugin/src/testData/codegen/basic.asm.txt create mode 100644 compiler/suspend-transform-plugin/src/testData/codegen/basic.fir.ir.txt create mode 100644 compiler/suspend-transform-plugin/src/testData/codegen/basic.fir.txt create mode 100644 compiler/suspend-transform-plugin/src/testData/codegen/override.asm.txt create mode 100644 compiler/suspend-transform-plugin/src/testData/codegen/override.fir.ir.txt create mode 100644 compiler/suspend-transform-plugin/src/testData/codegen/override.fir.txt create mode 100644 compiler/suspend-transform-plugin/src/testData/codegen/typeAttr.asm.txt create mode 100644 compiler/suspend-transform-plugin/src/testData/codegen/typeAttr.fir.ir.txt create mode 100644 compiler/suspend-transform-plugin/src/testData/codegen/typeAttr.fir.txt diff --git a/.gitignore b/.gitignore index 24e93b2..21f97e4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ .gradle +.kotlin build/ !gradle/wrapper/gradle-wrapper.jar !**/src/main/**/build/ @@ -28,4 +29,4 @@ out/ .vscode/ ### Mac OS ### -.DS_Store \ No newline at end of file +.DS_Store diff --git a/buildSrc/src/main/kotlin/IProject.kt b/buildSrc/src/main/kotlin/IProject.kt index 8d37063..e6fba79 100644 --- a/buildSrc/src/main/kotlin/IProject.kt +++ b/buildSrc/src/main/kotlin/IProject.kt @@ -9,7 +9,7 @@ object IProject : ProjectDetail() { const val DESCRIPTION = "Generate platform-compatible functions for Kotlin suspend functions" const val HOMEPAGE = "https://github.com/ForteScarlet/kotlin-suspend-transform-compiler-plugin" - override val version: Version = version(0, 7, 0) - version("dev1") + override val version: Version = version(0, 7, 0) - version("beta1") override val homepage: String get() = HOMEPAGE diff --git a/compiler/suspend-transform-plugin/build.gradle.kts b/compiler/suspend-transform-plugin/build.gradle.kts index b903be8..bc8c982 100644 --- a/compiler/suspend-transform-plugin/build.gradle.kts +++ b/compiler/suspend-transform-plugin/build.gradle.kts @@ -108,3 +108,7 @@ fun Test.setLibraryProperty(propName: String, jarName: String) { ?: return systemProperty(propName, path) } + +/* +上面与测试相关的一些内容参考自 https://github.com/Icyrockton/xjson + */ diff --git a/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/ir/SuspendTransformTransformer.kt b/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/ir/SuspendTransformTransformer.kt index 5d4f9d7..2e357db 100644 --- a/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/ir/SuspendTransformTransformer.kt +++ b/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/ir/SuspendTransformTransformer.kt @@ -1,7 +1,7 @@ package love.forte.plugin.suspendtrans.ir import love.forte.plugin.suspendtrans.* -import love.forte.plugin.suspendtrans.k2.fir.SuspendTransformPluginKey +import love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey import love.forte.plugin.suspendtrans.utils.* import org.jetbrains.kotlin.backend.common.IrElementTransformerVoidWithContext import org.jetbrains.kotlin.backend.common.extensions.IrPluginContext diff --git a/compiler/suspend-transform-plugin/src/test/love/forte/plugin/suspendtrans/services/SuspendTransformerEnvironmentConfigurator.kt b/compiler/suspend-transform-plugin/src/test/love/forte/plugin/suspendtrans/services/SuspendTransformerEnvironmentConfigurator.kt index c69a1e4..7d64a18 100644 --- a/compiler/suspend-transform-plugin/src/test/love/forte/plugin/suspendtrans/services/SuspendTransformerEnvironmentConfigurator.kt +++ b/compiler/suspend-transform-plugin/src/test/love/forte/plugin/suspendtrans/services/SuspendTransformerEnvironmentConfigurator.kt @@ -13,7 +13,7 @@ import org.jetbrains.kotlin.utils.PathUtil import java.io.File /** - * Inject XJson plugin into test environment + * Inject SuspendTransform plugin into test environment */ class SuspendTransformerEnvironmentConfigurator(testServices: TestServices) : EnvironmentConfigurator(testServices) { diff --git a/compiler/suspend-transform-plugin/src/testData/codegen/asProperty.asm.txt b/compiler/suspend-transform-plugin/src/testData/codegen/asProperty.asm.txt new file mode 100644 index 0000000..345f003 --- /dev/null +++ b/compiler/suspend-transform-plugin/src/testData/codegen/asProperty.asm.txt @@ -0,0 +1,83 @@ +final class PropFoo$ageAsync$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + int label + + final PropFoo this$0 + + void (PropFoo $receiver, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +final class PropFoo$ageBlocking$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + int label + + final PropFoo this$0 + + void (PropFoo $receiver, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +final class PropFoo$propAsync$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + int label + + final PropFoo this$0 + + void (PropFoo $receiver, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +final class PropFoo$propBlocking$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + int label + + final PropFoo this$0 + + void (PropFoo $receiver, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +public final class PropFoo : java/lang/Object { + public void () + + public final java.lang.Object age(kotlin.coroutines.Continuation $completion) + + public final java.util.concurrent.CompletableFuture ageAsync() + + public final int ageBlocking() + + public final java.lang.Object prop(kotlin.coroutines.Continuation $completion) + + public final java.util.concurrent.CompletableFuture propAsync() + + public final java.lang.String propBlocking() +} + +public abstract interface TA : java/lang/Object, java/lang/annotation/Annotation { + public abstract java.lang.String value() +} diff --git a/compiler/suspend-transform-plugin/src/testData/codegen/asProperty.fir.ir.txt b/compiler/suspend-transform-plugin/src/testData/codegen/asProperty.fir.ir.txt new file mode 100644 index 0000000..a908a0b --- /dev/null +++ b/compiler/suspend-transform-plugin/src/testData/codegen/asProperty.fir.ir.txt @@ -0,0 +1,136 @@ +FILE fqName: fileName:/Main.kt + CLASS ANNOTATION_CLASS name:TA modality:OPEN visibility:public superTypes:[kotlin.Annotation] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.TA + CONSTRUCTOR visibility:public <> (value:kotlin.String) returnType:.TA [primary] + VALUE_PARAMETER name:value index:0 type:kotlin.String + EXPRESSION_BODY + CONST String type=kotlin.String value="forte" + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ANNOTATION_CLASS name:TA modality:OPEN visibility:public superTypes:[kotlin.Annotation]' + PROPERTY name:value visibility:public modality:FINAL [val] + FIELD PROPERTY_BACKING_FIELD name:value type:kotlin.String visibility:private [final] + EXPRESSION_BODY + GET_VAR 'value: kotlin.String declared in .TA.' type=kotlin.String origin=INITIALIZE_PROPERTY_FROM_PARAMETER + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.TA) returnType:kotlin.String + correspondingProperty: PROPERTY name:value visibility:public modality:FINAL [val] + $this: VALUE_PARAMETER name: type:.TA + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun (): kotlin.String declared in .TA' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:value type:kotlin.String visibility:private [final]' type=kotlin.String origin=null + receiver: GET_VAR ': .TA declared in .TA.' type=.TA origin=null + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Annotation + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Annotation + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Annotation + $this: VALUE_PARAMETER name: type:kotlin.Any + CLASS CLASS name:PropFoo modality:FINAL visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.PropFoo + CONSTRUCTOR visibility:public <> () returnType:.PropFoo [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:PropFoo modality:FINAL visibility:public superTypes:[kotlin.Any]' + FUN name:prop visibility:public modality:FINAL <> ($this:.PropFoo) returnType:kotlin.String [suspend] + annotations: + JvmBlocking(baseName = , suffix = '', asProperty = 'true') + JvmAsync(baseName = , suffix = , asProperty = 'true') + TA(value = 'forliy') + $this: VALUE_PARAMETER name: type:.PropFoo + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun prop (): kotlin.String declared in .PropFoo' + CONST String type=kotlin.String value="" + FUN name:age visibility:public modality:FINAL <> ($this:.PropFoo) returnType:kotlin.Int [suspend] + annotations: + JvmBlocking(baseName = , suffix = , asProperty = ) + JvmAsync(baseName = , suffix = , asProperty = ) + $this: VALUE_PARAMETER name: type:.PropFoo + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun age (): kotlin.Int declared in .PropFoo' + CONST Int type=kotlin.Int value=1 + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:ageBlocking visibility:public modality:FINAL <> ($this:.PropFoo) returnType:kotlin.Int + annotations: + JvmAsync(baseName = , suffix = , asProperty = ) + Api4J + JvmSynthetic + $this: VALUE_PARAMETER name: type:.PropFoo + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun ageBlocking (): kotlin.Int declared in .PropFoo' + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Int [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): kotlin.Int declared in .PropFoo.ageBlocking' + CALL 'public final fun ageBlocking (): kotlin.Int declared in .PropFoo' type=kotlin.Int origin=null + $this: GET_VAR ': .PropFoo declared in .PropFoo.ageBlocking' type=.PropFoo origin=null + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:ageAsync visibility:public modality:FINAL <> ($this:.PropFoo) returnType:java.util.concurrent.CompletableFuture + annotations: + JvmBlocking(baseName = , suffix = , asProperty = ) + Api4J + JvmSynthetic + $this: VALUE_PARAMETER name: type:.PropFoo + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun ageAsync (): java.util.concurrent.CompletableFuture declared in .PropFoo' + CALL 'public final fun $runInAsync$ (block: kotlin.coroutines.SuspendFunction0, scope: kotlinx.coroutines.CoroutineScope?): java.util.concurrent.CompletableFuture declared in love.forte.plugin.suspendtrans.runtime' type=java.util.concurrent.CompletableFuture origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:java.util.concurrent.CompletableFuture [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): java.util.concurrent.CompletableFuture declared in .PropFoo.ageAsync' + CALL 'public final fun ageAsync (): java.util.concurrent.CompletableFuture declared in .PropFoo' type=java.util.concurrent.CompletableFuture origin=null + $this: GET_VAR ': .PropFoo declared in .PropFoo.ageAsync' type=.PropFoo origin=null + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:propAsync visibility:public modality:FINAL <> ($this:.PropFoo) returnType:java.util.concurrent.CompletableFuture + annotations: + JvmBlocking(baseName = , suffix = '', asProperty = 'true') + TA(value = 'forliy') + Api4J + JvmSynthetic + $this: VALUE_PARAMETER name: type:.PropFoo + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun propAsync (): java.util.concurrent.CompletableFuture declared in .PropFoo' + CALL 'public final fun $runInAsync$ (block: kotlin.coroutines.SuspendFunction0, scope: kotlinx.coroutines.CoroutineScope?): java.util.concurrent.CompletableFuture declared in love.forte.plugin.suspendtrans.runtime' type=java.util.concurrent.CompletableFuture origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:java.util.concurrent.CompletableFuture [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): java.util.concurrent.CompletableFuture declared in .PropFoo.propAsync' + CALL 'public final fun propAsync (): java.util.concurrent.CompletableFuture declared in .PropFoo' type=java.util.concurrent.CompletableFuture origin=null + $this: GET_VAR ': .PropFoo declared in .PropFoo.propAsync' type=.PropFoo origin=null + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:propBlocking visibility:public modality:FINAL <> ($this:.PropFoo) returnType:kotlin.String + annotations: + JvmAsync(baseName = , suffix = , asProperty = 'true') + TA(value = 'forliy') + Api4J + JvmSynthetic + $this: VALUE_PARAMETER name: type:.PropFoo + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun propBlocking (): kotlin.String declared in .PropFoo' + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.String [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .PropFoo.propBlocking' + CALL 'public final fun propBlocking (): kotlin.String declared in .PropFoo' type=kotlin.String origin=null + $this: GET_VAR ': .PropFoo declared in .PropFoo.propBlocking' type=.PropFoo origin=null + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any diff --git a/compiler/suspend-transform-plugin/src/testData/codegen/asProperty.fir.txt b/compiler/suspend-transform-plugin/src/testData/codegen/asProperty.fir.txt new file mode 100644 index 0000000..24c28f3 --- /dev/null +++ b/compiler/suspend-transform-plugin/src/testData/codegen/asProperty.fir.txt @@ -0,0 +1,32 @@ +FILE: Main.kt + public final annotation class TA : R|kotlin/Annotation| { + public constructor(value: R|kotlin/String| = String(forte)): R|TA| { + super() + } + + public final val value: R|kotlin/String| = R|/value| + public get(): R|kotlin/String| + + } + public final class PropFoo : R|kotlin/Any| { + public constructor(): R|PropFoo| { + super() + } + + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|(asProperty = Boolean(true), suffix = String()) @R|love/forte/plugin/suspendtrans/annotation/JvmAsync|(asProperty = Boolean(true)) @R|TA|(value = String(forliy)) public final suspend fun prop(): R|kotlin/String| { + ^prop String() + } + + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/JvmAsync|() public final suspend fun age(): R|kotlin/Int| { + ^age Int(1) + } + + @R|love/forte/plugin/suspendtrans/annotation/JvmAsync|() @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public final fun ageBlocking(): R|kotlin/Int| + + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public final fun ageAsync(): R|java/util/concurrent/CompletableFuture| + + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|(asProperty = Boolean(true), suffix = String()) @R|TA|(value = String(forliy)) @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public final fun propAsync(): R|java/util/concurrent/CompletableFuture| + + @R|love/forte/plugin/suspendtrans/annotation/JvmAsync|(asProperty = Boolean(true)) @R|TA|(value = String(forliy)) @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public final fun propBlocking(): R|kotlin/String| + + } diff --git a/compiler/suspend-transform-plugin/src/testData/codegen/basic.asm.txt b/compiler/suspend-transform-plugin/src/testData/codegen/basic.asm.txt new file mode 100644 index 0000000..ff786c2 --- /dev/null +++ b/compiler/suspend-transform-plugin/src/testData/codegen/basic.asm.txt @@ -0,0 +1,125 @@ +final class BasicBar$bar2Async$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + final int $i + + int label + + final BasicBar this$0 + + void (BasicBar $receiver, int $i, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +final class BasicBar$barAsync$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + int label + + final BasicBar this$0 + + void (BasicBar $receiver, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +public final class BasicBar : java/lang/Object { + public void () + + public final java.lang.Object bar(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object bar2(int i, kotlin.coroutines.Continuation $completion) + + public final java.util.concurrent.CompletableFuture bar2Async(int i) + + public final java.util.concurrent.CompletableFuture barAsync() +} + +final class BasicFoo$fooAsync$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + int label + + final BasicFoo this$0 + + void (BasicFoo $receiver, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +public final class BasicFoo : java/lang/Object { + public void () + + public final java.lang.Object foo(kotlin.coroutines.Continuation $completion) + + public final java.util.concurrent.CompletableFuture fooAsync() +} + +public final class InterfaceBar$DefaultImpls : java/lang/Object { + public static java.util.concurrent.CompletableFuture bar2Async(InterfaceBar $this, int i) + + public static java.util.concurrent.CompletableFuture barAsync(InterfaceBar $this) +} + +final class InterfaceBar$bar2Async$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + final int $i + + int label + + final InterfaceBar this$0 + + void (InterfaceBar $receiver, int $i, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +final class InterfaceBar$barAsync$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + int label + + final InterfaceBar this$0 + + void (InterfaceBar $receiver, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +public abstract interface InterfaceBar : java/lang/Object { + public abstract ResultValue asyncBase(int p0) + + public abstract java.lang.Object bar(kotlin.coroutines.Continuation p0) + + public abstract java.lang.Object bar2(int p0, kotlin.coroutines.Continuation p1) + + public abstract java.util.concurrent.CompletableFuture bar2Async(int p0) + + public abstract java.util.concurrent.CompletableFuture barAsync() +} + +public final class ResultValue : java/lang/Object { + public void () +} diff --git a/compiler/suspend-transform-plugin/src/testData/codegen/basic.fir.ir.txt b/compiler/suspend-transform-plugin/src/testData/codegen/basic.fir.ir.txt new file mode 100644 index 0000000..f6979b9 --- /dev/null +++ b/compiler/suspend-transform-plugin/src/testData/codegen/basic.fir.ir.txt @@ -0,0 +1,187 @@ +FILE fqName: fileName:/Main.kt + CLASS CLASS name:BasicFoo modality:FINAL visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.BasicFoo + CONSTRUCTOR visibility:public <> () returnType:.BasicFoo [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:BasicFoo modality:FINAL visibility:public superTypes:[kotlin.Any]' + FUN name:foo visibility:public modality:FINAL <> ($this:.BasicFoo) returnType:kotlin.String [suspend] + annotations: + JvmAsync(baseName = , suffix = , asProperty = ) + $this: VALUE_PARAMETER name: type:.BasicFoo + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun foo (): kotlin.String declared in .BasicFoo' + CONST String type=kotlin.String value="foo" + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:fooAsync visibility:public modality:FINAL <> ($this:.BasicFoo) returnType:java.util.concurrent.CompletableFuture + annotations: + Api4J + JvmSynthetic + $this: VALUE_PARAMETER name: type:.BasicFoo + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun fooAsync (): java.util.concurrent.CompletableFuture declared in .BasicFoo' + CALL 'public final fun $runInAsync$ (block: kotlin.coroutines.SuspendFunction0, scope: kotlinx.coroutines.CoroutineScope?): java.util.concurrent.CompletableFuture declared in love.forte.plugin.suspendtrans.runtime' type=java.util.concurrent.CompletableFuture origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:java.util.concurrent.CompletableFuture [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): java.util.concurrent.CompletableFuture declared in .BasicFoo.fooAsync' + CALL 'public final fun fooAsync (): java.util.concurrent.CompletableFuture declared in .BasicFoo' type=java.util.concurrent.CompletableFuture origin=null + $this: GET_VAR ': .BasicFoo declared in .BasicFoo.fooAsync' type=.BasicFoo origin=null + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + CLASS CLASS name:BasicBar modality:FINAL visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.BasicBar + CONSTRUCTOR visibility:public <> () returnType:.BasicBar [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:BasicBar modality:FINAL visibility:public superTypes:[kotlin.Any]' + FUN name:bar visibility:public modality:FINAL <> ($this:.BasicBar) returnType:kotlin.String [suspend] + annotations: + JvmAsync(baseName = , suffix = , asProperty = ) + $this: VALUE_PARAMETER name: type:.BasicBar + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun bar (): kotlin.String declared in .BasicBar' + CONST String type=kotlin.String value="bar" + FUN name:bar2 visibility:public modality:FINAL <> ($this:.BasicBar, i:kotlin.Int) returnType:kotlin.String [suspend] + annotations: + JvmAsync(baseName = , suffix = , asProperty = ) + $this: VALUE_PARAMETER name: type:.BasicBar + VALUE_PARAMETER name:i index:0 type:kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun bar2 (i: kotlin.Int): kotlin.String declared in .BasicBar' + CONST String type=kotlin.String value="bar2" + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:bar2Async visibility:public modality:FINAL <> ($this:.BasicBar, i:kotlin.Int) returnType:java.util.concurrent.CompletableFuture + annotations: + Api4J + JvmSynthetic + $this: VALUE_PARAMETER name: type:.BasicBar + VALUE_PARAMETER name:i index:0 type:kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun bar2Async (i: kotlin.Int): java.util.concurrent.CompletableFuture declared in .BasicBar' + CALL 'public final fun $runInAsync$ (block: kotlin.coroutines.SuspendFunction0, scope: kotlinx.coroutines.CoroutineScope?): java.util.concurrent.CompletableFuture declared in love.forte.plugin.suspendtrans.runtime' type=java.util.concurrent.CompletableFuture origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:java.util.concurrent.CompletableFuture [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): java.util.concurrent.CompletableFuture declared in .BasicBar.bar2Async' + CALL 'public final fun bar2Async (i: kotlin.Int): java.util.concurrent.CompletableFuture declared in .BasicBar' type=java.util.concurrent.CompletableFuture origin=null + $this: GET_VAR ': .BasicBar declared in .BasicBar.bar2Async' type=.BasicBar origin=null + i: GET_VAR 'i: kotlin.Int declared in .BasicBar.bar2Async' type=kotlin.Int origin=null + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:barAsync visibility:public modality:FINAL <> ($this:.BasicBar) returnType:java.util.concurrent.CompletableFuture + annotations: + Api4J + JvmSynthetic + $this: VALUE_PARAMETER name: type:.BasicBar + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun barAsync (): java.util.concurrent.CompletableFuture declared in .BasicBar' + CALL 'public final fun $runInAsync$ (block: kotlin.coroutines.SuspendFunction0, scope: kotlinx.coroutines.CoroutineScope?): java.util.concurrent.CompletableFuture declared in love.forte.plugin.suspendtrans.runtime' type=java.util.concurrent.CompletableFuture origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:java.util.concurrent.CompletableFuture [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): java.util.concurrent.CompletableFuture declared in .BasicBar.barAsync' + CALL 'public final fun barAsync (): java.util.concurrent.CompletableFuture declared in .BasicBar' type=java.util.concurrent.CompletableFuture origin=null + $this: GET_VAR ': .BasicBar declared in .BasicBar.barAsync' type=.BasicBar origin=null + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + CLASS INTERFACE name:InterfaceBar modality:ABSTRACT visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.InterfaceBar + FUN name:bar visibility:public modality:ABSTRACT <> ($this:.InterfaceBar) returnType:kotlin.String [suspend] + annotations: + JvmAsync(baseName = , suffix = , asProperty = ) + $this: VALUE_PARAMETER name: type:.InterfaceBar + FUN name:bar2 visibility:public modality:ABSTRACT <> ($this:.InterfaceBar, i:kotlin.Int) returnType:kotlin.String [suspend] + annotations: + JvmAsync(baseName = , suffix = , asProperty = ) + $this: VALUE_PARAMETER name: type:.InterfaceBar + VALUE_PARAMETER name:i index:0 type:kotlin.Int + FUN name:asyncBase visibility:public modality:ABSTRACT <> ($this:.InterfaceBar, i:kotlin.Int) returnType:.ResultValue + $this: VALUE_PARAMETER name: type:.InterfaceBar + VALUE_PARAMETER name:i index:0 type:kotlin.Int + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:bar2Async visibility:public modality:OPEN <> ($this:.InterfaceBar, i:kotlin.Int) returnType:java.util.concurrent.CompletableFuture + annotations: + Api4J + JvmSynthetic + $this: VALUE_PARAMETER name: type:.InterfaceBar + VALUE_PARAMETER name:i index:0 type:kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun bar2Async (i: kotlin.Int): java.util.concurrent.CompletableFuture declared in .InterfaceBar' + CALL 'public final fun $runInAsync$ (block: kotlin.coroutines.SuspendFunction0, scope: kotlinx.coroutines.CoroutineScope?): java.util.concurrent.CompletableFuture declared in love.forte.plugin.suspendtrans.runtime' type=java.util.concurrent.CompletableFuture origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:java.util.concurrent.CompletableFuture [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): java.util.concurrent.CompletableFuture declared in .InterfaceBar.bar2Async' + CALL 'public open fun bar2Async (i: kotlin.Int): java.util.concurrent.CompletableFuture declared in .InterfaceBar' type=java.util.concurrent.CompletableFuture origin=null + $this: GET_VAR ': .InterfaceBar declared in .InterfaceBar.bar2Async' type=.InterfaceBar origin=null + i: GET_VAR 'i: kotlin.Int declared in .InterfaceBar.bar2Async' type=kotlin.Int origin=null + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:barAsync visibility:public modality:OPEN <> ($this:.InterfaceBar) returnType:java.util.concurrent.CompletableFuture + annotations: + Api4J + JvmSynthetic + $this: VALUE_PARAMETER name: type:.InterfaceBar + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun barAsync (): java.util.concurrent.CompletableFuture declared in .InterfaceBar' + CALL 'public final fun $runInAsync$ (block: kotlin.coroutines.SuspendFunction0, scope: kotlinx.coroutines.CoroutineScope?): java.util.concurrent.CompletableFuture declared in love.forte.plugin.suspendtrans.runtime' type=java.util.concurrent.CompletableFuture origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:java.util.concurrent.CompletableFuture [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): java.util.concurrent.CompletableFuture declared in .InterfaceBar.barAsync' + CALL 'public open fun barAsync (): java.util.concurrent.CompletableFuture declared in .InterfaceBar' type=java.util.concurrent.CompletableFuture origin=null + $this: GET_VAR ': .InterfaceBar declared in .InterfaceBar.barAsync' type=.InterfaceBar origin=null + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + CLASS CLASS name:ResultValue modality:FINAL visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.ResultValue.ResultValue> + TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?] reified:false + CONSTRUCTOR visibility:public <> () returnType:.ResultValue.ResultValue> [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:ResultValue modality:FINAL visibility:public superTypes:[kotlin.Any]' + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any diff --git a/compiler/suspend-transform-plugin/src/testData/codegen/basic.fir.txt b/compiler/suspend-transform-plugin/src/testData/codegen/basic.fir.txt new file mode 100644 index 0000000..61ce273 --- /dev/null +++ b/compiler/suspend-transform-plugin/src/testData/codegen/basic.fir.txt @@ -0,0 +1,49 @@ +FILE: Main.kt + public final class BasicFoo : R|kotlin/Any| { + public constructor(): R|BasicFoo| { + super() + } + + @R|love/forte/plugin/suspendtrans/annotation/JvmAsync|() public final suspend fun foo(): R|kotlin/String| { + ^foo String(foo) + } + + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public final fun fooAsync(): R|java/util/concurrent/CompletableFuture| + + } + public final class BasicBar : R|kotlin/Any| { + public constructor(): R|BasicBar| { + super() + } + + @R|love/forte/plugin/suspendtrans/annotation/JvmAsync|() public final suspend fun bar(): R|kotlin/String| { + ^bar String(bar) + } + + @R|love/forte/plugin/suspendtrans/annotation/JvmAsync|() public final suspend fun bar2(i: R|kotlin/Int|): R|kotlin/String| { + ^bar2 String(bar2) + } + + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public final fun bar2Async(i: R|kotlin/Int|): R|java/util/concurrent/CompletableFuture| + + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public final fun barAsync(): R|java/util/concurrent/CompletableFuture| + + } + public abstract interface InterfaceBar : R|kotlin/Any| { + @R|love/forte/plugin/suspendtrans/annotation/JvmAsync|() public abstract suspend fun bar(): R|kotlin/String| + + @R|love/forte/plugin/suspendtrans/annotation/JvmAsync|() public abstract suspend fun bar2(i: R|kotlin/Int|): R|kotlin/String| + + public abstract fun asyncBase(i: R|kotlin/Int|): R|ResultValue| + + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun bar2Async(i: R|kotlin/Int|): R|java/util/concurrent/CompletableFuture| + + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun barAsync(): R|java/util/concurrent/CompletableFuture| + + } + public final class ResultValue : R|kotlin/Any| { + public constructor(): R|ResultValue| { + super() + } + + } diff --git a/compiler/suspend-transform-plugin/src/testData/codegen/override.asm.txt b/compiler/suspend-transform-plugin/src/testData/codegen/override.asm.txt new file mode 100644 index 0000000..bdc9c08 --- /dev/null +++ b/compiler/suspend-transform-plugin/src/testData/codegen/override.asm.txt @@ -0,0 +1,131 @@ +public class Bar : java/lang/Object { + public void () +} + +public final class Foo$DefaultImpls : java/lang/Object { + public static java.lang.Object run(Foo $this, java.lang.String name, kotlin.coroutines.Continuation $completion) + + public static java.util.concurrent.CompletableFuture runAsync(Foo $this) + + public static java.util.concurrent.CompletableFuture runAsync(Foo $this, int n) + + public static Bar runBlocking(Foo $this) + + public static Bar runBlocking(Foo $this, int n) +} + +final class Foo$runAsync$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + int label + + final Foo this$0 + + void (Foo $receiver, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +final class Foo$runBlocking$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + int label + + final Foo this$0 + + void (Foo $receiver, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +public abstract interface Foo : java/lang/Object, IFoo { + public abstract java.lang.Object run(kotlin.coroutines.Continuation p0) + + public abstract java.lang.Object run(java.lang.String p0, kotlin.coroutines.Continuation p1) + + public abstract java.lang.Object run(int p0, kotlin.coroutines.Continuation p1) + + public abstract java.util.concurrent.CompletableFuture runAsync() + + public abstract Bar runBlocking() +} + +public final class FooImpl : java/lang/Object, Foo { + public void () + + public java.lang.Object run(kotlin.coroutines.Continuation $completion) + + public java.lang.Object run(java.lang.String name, kotlin.coroutines.Continuation $completion) + + public java.lang.Object run(int n, kotlin.coroutines.Continuation $completion) + + public java.util.concurrent.CompletableFuture runAsync() + + public java.util.concurrent.CompletableFuture runAsync(int n) + + public Bar runBlocking() + + public Bar runBlocking(int n) +} + +public final class IFoo$DefaultImpls : java/lang/Object { + public static java.util.concurrent.CompletableFuture runAsync(IFoo $this, int n) + + public static Bar runBlocking(IFoo $this, int n) +} + +final class IFoo$runAsync$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + final int $n + + int label + + final IFoo this$0 + + void (IFoo $receiver, int $n, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +final class IFoo$runBlocking$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + final int $n + + int label + + final IFoo this$0 + + void (IFoo $receiver, int $n, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +public abstract interface IFoo : java/lang/Object { + public abstract java.lang.Object run(int p0, kotlin.coroutines.Continuation p1) + + public abstract java.util.concurrent.CompletableFuture runAsync(int p0) + + public abstract Bar runBlocking(int p0) +} + +public final class Tar : Bar { + public void () +} diff --git a/compiler/suspend-transform-plugin/src/testData/codegen/override.fir.ir.txt b/compiler/suspend-transform-plugin/src/testData/codegen/override.fir.ir.txt new file mode 100644 index 0000000..0957c77 --- /dev/null +++ b/compiler/suspend-transform-plugin/src/testData/codegen/override.fir.ir.txt @@ -0,0 +1,241 @@ +FILE fqName: fileName:/Main.kt + CLASS INTERFACE name:IFoo modality:ABSTRACT visibility:public superTypes:[kotlin.Any] + annotations: + JvmBlocking(baseName = , suffix = , asProperty = ) + JvmAsync(baseName = , suffix = , asProperty = ) + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.IFoo + FUN name:run visibility:public modality:ABSTRACT <> ($this:.IFoo, n:kotlin.Int) returnType:.Bar [suspend] + $this: VALUE_PARAMETER name: type:.IFoo + VALUE_PARAMETER name:n index:0 type:kotlin.Int + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:runAsync visibility:public modality:OPEN <> ($this:.IFoo, n:kotlin.Int) returnType:java.util.concurrent.CompletableFuture + annotations: + Api4J + JvmSynthetic + $this: VALUE_PARAMETER name: type:.IFoo + VALUE_PARAMETER name:n index:0 type:kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun runAsync (n: kotlin.Int): java.util.concurrent.CompletableFuture declared in .IFoo' + CALL 'public final fun $runInAsync$ (block: kotlin.coroutines.SuspendFunction0, scope: kotlinx.coroutines.CoroutineScope?): java.util.concurrent.CompletableFuture declared in love.forte.plugin.suspendtrans.runtime' type=java.util.concurrent.CompletableFuture origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:java.util.concurrent.CompletableFuture [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): java.util.concurrent.CompletableFuture declared in .IFoo.runAsync' + CALL 'public open fun runAsync (n: kotlin.Int): java.util.concurrent.CompletableFuture declared in .IFoo' type=java.util.concurrent.CompletableFuture origin=null + $this: GET_VAR ': .IFoo declared in .IFoo.runAsync' type=.IFoo origin=null + n: GET_VAR 'n: kotlin.Int declared in .IFoo.runAsync' type=kotlin.Int origin=null + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:runBlocking visibility:public modality:OPEN <> ($this:.IFoo, n:kotlin.Int) returnType:.Bar + annotations: + Api4J + JvmSynthetic + $this: VALUE_PARAMETER name: type:.IFoo + VALUE_PARAMETER name:n index:0 type:kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun runBlocking (n: kotlin.Int): .Bar declared in .IFoo' + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0<.Bar> origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:.Bar [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): .Bar declared in .IFoo.runBlocking' + CALL 'public open fun runBlocking (n: kotlin.Int): .Bar declared in .IFoo' type=.Bar origin=null + $this: GET_VAR ': .IFoo declared in .IFoo.runBlocking' type=.IFoo origin=null + n: GET_VAR 'n: kotlin.Int declared in .IFoo.runBlocking' type=kotlin.Int origin=null + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + CLASS INTERFACE name:Foo modality:ABSTRACT visibility:public superTypes:[.IFoo] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Foo + FUN name:run visibility:public modality:ABSTRACT <> ($this:.Foo) returnType:.Bar [suspend] + annotations: + JvmBlocking(baseName = , suffix = , asProperty = ) + JvmAsync(baseName = , suffix = , asProperty = ) + $this: VALUE_PARAMETER name: type:.Foo + FUN name:run visibility:public modality:OPEN <> ($this:.Foo, name:kotlin.String) returnType:.Tar [suspend] + $this: VALUE_PARAMETER name: type:.Foo + VALUE_PARAMETER name:name index:0 type:kotlin.String + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun run (name: kotlin.String): .Tar declared in .Foo' + CONSTRUCTOR_CALL 'public constructor () declared in .Tar' type=.Tar origin=null + FUN name:run visibility:public modality:ABSTRACT <> ($this:.Foo, n:kotlin.Int) returnType:.Bar [suspend] + overridden: + public abstract fun run (n: kotlin.Int): .Bar declared in .IFoo + $this: VALUE_PARAMETER name: type:.Foo + VALUE_PARAMETER name:n index:0 type:kotlin.Int + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:runAsync visibility:public modality:OPEN <> ($this:.Foo) returnType:java.util.concurrent.CompletableFuture + annotations: + JvmBlocking(baseName = , suffix = , asProperty = ) + Api4J + JvmSynthetic + $this: VALUE_PARAMETER name: type:.Foo + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun runAsync (): java.util.concurrent.CompletableFuture declared in .Foo' + CALL 'public final fun $runInAsync$ (block: kotlin.coroutines.SuspendFunction0, scope: kotlinx.coroutines.CoroutineScope?): java.util.concurrent.CompletableFuture declared in love.forte.plugin.suspendtrans.runtime' type=java.util.concurrent.CompletableFuture origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:java.util.concurrent.CompletableFuture [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): java.util.concurrent.CompletableFuture declared in .Foo.runAsync' + CALL 'public open fun runAsync (): java.util.concurrent.CompletableFuture declared in .Foo' type=java.util.concurrent.CompletableFuture origin=null + $this: GET_VAR ': .Foo declared in .Foo.runAsync' type=.Foo origin=null + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:runBlocking visibility:public modality:OPEN <> ($this:.Foo) returnType:.Bar + annotations: + JvmAsync(baseName = , suffix = , asProperty = ) + Api4J + JvmSynthetic + $this: VALUE_PARAMETER name: type:.Foo + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun runBlocking (): .Bar declared in .Foo' + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0<.Bar> origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:.Bar [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): .Bar declared in .Foo.runBlocking' + CALL 'public open fun runBlocking (): .Bar declared in .Foo' type=.Bar origin=null + $this: GET_VAR ': .Foo declared in .Foo.runBlocking' type=.Foo origin=null + FUN FAKE_OVERRIDE name:runAsync visibility:public modality:OPEN <> ($this:.IFoo, n:kotlin.Int) returnType:java.util.concurrent.CompletableFuture [fake_override] + annotations: + Api4J + overridden: + public open fun runAsync (n: kotlin.Int): java.util.concurrent.CompletableFuture declared in .IFoo + $this: VALUE_PARAMETER name: type:.IFoo + VALUE_PARAMETER name:n index:0 type:kotlin.Int + FUN FAKE_OVERRIDE name:runBlocking visibility:public modality:OPEN <> ($this:.IFoo, n:kotlin.Int) returnType:.Bar [fake_override] + annotations: + Api4J + overridden: + public open fun runBlocking (n: kotlin.Int): .Bar declared in .IFoo + $this: VALUE_PARAMETER name: type:.IFoo + VALUE_PARAMETER name:n index:0 type:kotlin.Int + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .IFoo + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in .IFoo + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in .IFoo + $this: VALUE_PARAMETER name: type:kotlin.Any + CLASS CLASS name:FooImpl modality:FINAL visibility:public superTypes:[.Foo] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.FooImpl + CONSTRUCTOR visibility:public <> () returnType:.FooImpl [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:FooImpl modality:FINAL visibility:public superTypes:[.Foo]' + FUN name:run visibility:public modality:OPEN <> ($this:.FooImpl) returnType:.Tar [suspend] + overridden: + public abstract fun run (): .Bar declared in .Foo + $this: VALUE_PARAMETER name: type:.FooImpl + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun run (): .Tar declared in .FooImpl' + CONSTRUCTOR_CALL 'public constructor () declared in .Tar' type=.Tar origin=null + FUN name:run visibility:public modality:OPEN <> ($this:.FooImpl, name:kotlin.String) returnType:.Tar [suspend] + overridden: + public open fun run (name: kotlin.String): .Tar declared in .Foo + $this: VALUE_PARAMETER name: type:.FooImpl + VALUE_PARAMETER name:name index:0 type:kotlin.String + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun run (name: kotlin.String): .Tar declared in .FooImpl' + CONSTRUCTOR_CALL 'public constructor () declared in .Tar' type=.Tar origin=null + FUN name:run visibility:public modality:OPEN <> ($this:.FooImpl, n:kotlin.Int) returnType:.Bar [suspend] + overridden: + public abstract fun run (n: kotlin.Int): .Bar declared in .Foo + $this: VALUE_PARAMETER name: type:.FooImpl + VALUE_PARAMETER name:n index:0 type:kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun run (n: kotlin.Int): .Bar declared in .FooImpl' + CONSTRUCTOR_CALL 'public constructor () declared in .Tar' type=.Tar origin=null + FUN FAKE_OVERRIDE name:runAsync visibility:public modality:OPEN <> ($this:.Foo) returnType:java.util.concurrent.CompletableFuture [fake_override] + annotations: + JvmBlocking(baseName = , suffix = , asProperty = ) + Api4J + overridden: + public open fun runAsync (): java.util.concurrent.CompletableFuture declared in .Foo + $this: VALUE_PARAMETER name: type:.Foo + FUN FAKE_OVERRIDE name:runAsync visibility:public modality:OPEN <> ($this:.IFoo, n:kotlin.Int) returnType:java.util.concurrent.CompletableFuture [fake_override] + annotations: + Api4J + overridden: + public open fun runAsync (n: kotlin.Int): java.util.concurrent.CompletableFuture declared in .Foo + $this: VALUE_PARAMETER name: type:.IFoo + VALUE_PARAMETER name:n index:0 type:kotlin.Int + FUN FAKE_OVERRIDE name:runBlocking visibility:public modality:OPEN <> ($this:.Foo) returnType:.Bar [fake_override] + annotations: + JvmAsync(baseName = , suffix = , asProperty = ) + Api4J + overridden: + public open fun runBlocking (): .Bar declared in .Foo + $this: VALUE_PARAMETER name: type:.Foo + FUN FAKE_OVERRIDE name:runBlocking visibility:public modality:OPEN <> ($this:.IFoo, n:kotlin.Int) returnType:.Bar [fake_override] + annotations: + Api4J + overridden: + public open fun runBlocking (n: kotlin.Int): .Bar declared in .Foo + $this: VALUE_PARAMETER name: type:.IFoo + VALUE_PARAMETER name:n index:0 type:kotlin.Int + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .Foo + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in .Foo + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in .Foo + $this: VALUE_PARAMETER name: type:kotlin.Any + CLASS CLASS name:Bar modality:OPEN visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Bar + CONSTRUCTOR visibility:public <> () returnType:.Bar [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Bar modality:OPEN visibility:public superTypes:[kotlin.Any]' + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + CLASS CLASS name:Tar modality:FINAL visibility:public superTypes:[.Bar] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Tar + CONSTRUCTOR visibility:public <> () returnType:.Tar [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () declared in .Bar' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Tar modality:FINAL visibility:public superTypes:[.Bar]' + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .Bar + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in .Bar + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in .Bar + $this: VALUE_PARAMETER name: type:kotlin.Any diff --git a/compiler/suspend-transform-plugin/src/testData/codegen/override.fir.txt b/compiler/suspend-transform-plugin/src/testData/codegen/override.fir.txt new file mode 100644 index 0000000..a0237be --- /dev/null +++ b/compiler/suspend-transform-plugin/src/testData/codegen/override.fir.txt @@ -0,0 +1,53 @@ +FILE: Main.kt + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/JvmAsync|() public abstract interface IFoo : R|kotlin/Any| { + public abstract suspend fun run(n: R|kotlin/Int|): R|Bar| + + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun runAsync(n: R|kotlin/Int|): R|java/util/concurrent/CompletableFuture| + + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun runBlocking(n: R|kotlin/Int|): R|Bar| + + } + public abstract interface Foo : R|IFoo| { + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/JvmAsync|() public abstract suspend fun run(): R|Bar| + + public open suspend fun run(name: R|kotlin/String|): R|Tar| { + ^run R|/Tar.Tar|() + } + + public abstract override suspend fun run(n: R|kotlin/Int|): R|Bar| + + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun runAsync(): R|java/util/concurrent/CompletableFuture| + + @R|love/forte/plugin/suspendtrans/annotation/JvmAsync|() @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun runBlocking(): R|Bar| + + } + public final class FooImpl : R|Foo| { + public constructor(): R|FooImpl| { + super() + } + + public open override suspend fun run(): R|Tar| { + ^run R|/Tar.Tar|() + } + + public open override suspend fun run(name: R|kotlin/String|): R|Tar| { + ^run R|/Tar.Tar|() + } + + public open override suspend fun run(n: R|kotlin/Int|): R|Bar| { + ^run R|/Tar.Tar|() + } + + } + public open class Bar : R|kotlin/Any| { + public constructor(): R|Bar| { + super() + } + + } + public final class Tar : R|Bar| { + public constructor(): R|Tar| { + super() + } + + } diff --git a/compiler/suspend-transform-plugin/src/testData/codegen/typeAttr.asm.txt b/compiler/suspend-transform-plugin/src/testData/codegen/typeAttr.asm.txt new file mode 100644 index 0000000..1a11af9 --- /dev/null +++ b/compiler/suspend-transform-plugin/src/testData/codegen/typeAttr.asm.txt @@ -0,0 +1,65 @@ +public class Bar : java/lang/Object { + public void () +} + +public final class Foo$DefaultImpls : java/lang/Object { + public static java.util.concurrent.CompletableFuture valueAsync(Foo $this) + + public static Bar valueBlocking(Foo $this) +} + +final class Foo$valueAsync$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + int label + + final Foo this$0 + + void (Foo $receiver, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +final class Foo$valueBlocking$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + int label + + final Foo this$0 + + void (Foo $receiver, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +public abstract interface Foo : java/lang/Object { + public abstract java.lang.Object value(kotlin.coroutines.Continuation p0) + + public abstract java.util.concurrent.CompletableFuture valueAsync() + + public abstract Bar valueBlocking() +} + +public final class FooImpl : java/lang/Object, Foo { + public void () + + public java.lang.Object value(kotlin.coroutines.Continuation $completion) + + public java.util.concurrent.CompletableFuture valueAsync() + + public Tar valueBlocking() + + public Bar valueBlocking() +} + +public final class Tar : Bar { + public void () +} diff --git a/compiler/suspend-transform-plugin/src/testData/codegen/typeAttr.fir.ir.txt b/compiler/suspend-transform-plugin/src/testData/codegen/typeAttr.fir.ir.txt new file mode 100644 index 0000000..7a35dc2 --- /dev/null +++ b/compiler/suspend-transform-plugin/src/testData/codegen/typeAttr.fir.ir.txt @@ -0,0 +1,132 @@ +FILE fqName: fileName:/Main.kt + CLASS CLASS name:Bar modality:OPEN visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Bar + CONSTRUCTOR visibility:public <> () returnType:.Bar [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Bar modality:OPEN visibility:public superTypes:[kotlin.Any]' + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + CLASS CLASS name:Tar modality:FINAL visibility:public superTypes:[.Bar] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Tar + CONSTRUCTOR visibility:public <> () returnType:.Tar [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () declared in .Bar' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Tar modality:FINAL visibility:public superTypes:[.Bar]' + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .Bar + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in .Bar + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in .Bar + $this: VALUE_PARAMETER name: type:kotlin.Any + CLASS INTERFACE name:Foo modality:ABSTRACT visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Foo.Foo> + TYPE_PARAMETER name:T index:0 variance:out superTypes:[.Bar] reified:false + FUN name:value visibility:public modality:ABSTRACT <> ($this:.Foo.Foo>) returnType:T of .Foo [suspend] + annotations: + JvmBlocking(baseName = , suffix = , asProperty = ) + JvmAsync(baseName = , suffix = , asProperty = ) + $this: VALUE_PARAMETER name: type:.Foo.Foo> + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:valueAsync visibility:public modality:OPEN <> ($this:.Foo.Foo>) returnType:java.util.concurrent.CompletableFuture + annotations: + JvmBlocking(baseName = , suffix = , asProperty = ) + Api4J + JvmSynthetic + $this: VALUE_PARAMETER name: type:.Foo.Foo> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun valueAsync (): java.util.concurrent.CompletableFuture declared in .Foo' + CALL 'public final fun $runInAsync$ (block: kotlin.coroutines.SuspendFunction0, scope: kotlinx.coroutines.CoroutineScope?): java.util.concurrent.CompletableFuture declared in love.forte.plugin.suspendtrans.runtime' type=java.util.concurrent.CompletableFuture origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:java.util.concurrent.CompletableFuture [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): java.util.concurrent.CompletableFuture declared in .Foo.valueAsync' + CALL 'public open fun valueAsync (): java.util.concurrent.CompletableFuture declared in .Foo' type=java.util.concurrent.CompletableFuture origin=null + $this: GET_VAR ': .Foo.Foo> declared in .Foo.valueAsync' type=.Foo.Foo> origin=null + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:valueBlocking visibility:public modality:OPEN <> ($this:.Foo.Foo>) returnType:T of .Foo + annotations: + JvmAsync(baseName = , suffix = , asProperty = ) + Api4J + JvmSynthetic + $this: VALUE_PARAMETER name: type:.Foo.Foo> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun valueBlocking (): T of .Foo declared in .Foo' + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0.Foo> origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:T of .Foo [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): T of .Foo declared in .Foo.valueBlocking' + CALL 'public open fun valueBlocking (): T of .Foo declared in .Foo' type=T of .Foo origin=null + $this: GET_VAR ': .Foo.Foo> declared in .Foo.valueBlocking' type=.Foo.Foo> origin=null + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + CLASS CLASS name:FooImpl modality:FINAL visibility:public superTypes:[.Foo<.Tar>] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.FooImpl + CONSTRUCTOR visibility:public <> () returnType:.FooImpl [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:FooImpl modality:FINAL visibility:public superTypes:[.Foo<.Tar>]' + FUN name:value visibility:public modality:OPEN <> ($this:.FooImpl) returnType:.Tar [suspend] + overridden: + public abstract fun value (): T of .Foo declared in .Foo + $this: VALUE_PARAMETER name: type:.FooImpl + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun value (): .Tar declared in .FooImpl' + CONSTRUCTOR_CALL 'public constructor () declared in .Tar' type=.Tar origin=null + FUN FAKE_OVERRIDE name:valueAsync visibility:public modality:OPEN <> ($this:.Foo.Foo>) returnType:java.util.concurrent.CompletableFuture [fake_override] + annotations: + JvmBlocking(baseName = , suffix = , asProperty = ) + Api4J + overridden: + public open fun valueAsync (): java.util.concurrent.CompletableFuture declared in .Foo + $this: VALUE_PARAMETER name: type:.Foo.Foo> + FUN FAKE_OVERRIDE name:valueBlocking visibility:public modality:OPEN <> ($this:.Foo.Foo>) returnType:.Tar [fake_override] + annotations: + JvmAsync(baseName = , suffix = , asProperty = ) + Api4J + overridden: + public open fun valueBlocking (): T of .Foo declared in .Foo + $this: VALUE_PARAMETER name: type:.Foo.Foo> + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .Foo + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in .Foo + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in .Foo + $this: VALUE_PARAMETER name: type:kotlin.Any diff --git a/compiler/suspend-transform-plugin/src/testData/codegen/typeAttr.fir.txt b/compiler/suspend-transform-plugin/src/testData/codegen/typeAttr.fir.txt new file mode 100644 index 0000000..dc06b72 --- /dev/null +++ b/compiler/suspend-transform-plugin/src/testData/codegen/typeAttr.fir.txt @@ -0,0 +1,31 @@ +FILE: Main.kt + public open class Bar : R|kotlin/Any| { + public constructor(): R|Bar| { + super() + } + + } + public final class Tar : R|Bar| { + public constructor(): R|Tar| { + super() + } + + } + public abstract interface Foo : R|kotlin/Any| { + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/JvmAsync|() public abstract suspend fun value(): R|T| + + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun valueAsync(): R|java/util/concurrent/CompletableFuture| + + @R|love/forte/plugin/suspendtrans/annotation/JvmAsync|() @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun valueBlocking(): R|T| + + } + public final class FooImpl : R|Foo| { + public constructor(): R|FooImpl| { + super() + } + + public open override suspend fun value(): R|Tar| { + ^value R|/Tar.Tar|() + } + + } From aa26d5ce77065604ed5ce1072e332d086dc27495 Mon Sep 17 00:00:00 2001 From: ForteScarlet Date: Thu, 25 Jan 2024 22:57:44 +0800 Subject: [PATCH 5/8] Update README --- README.md | 8 ++++++++ README_CN.md | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/README.md b/README.md index 69f0e90..a16822d 100644 --- a/README.md +++ b/README.md @@ -74,6 +74,7 @@ class Foo { ### WasmJS +> [!warning] > Since `v0.6.0`, In experiments, immature and unstable ```kotlin @@ -258,6 +259,13 @@ suspendTransform { **Gradle JVM** must be JDK11+ +### K2 + +K2 is supported since `v0.7.0`. + +> [!warning] +> In experiments. + ## Effect **source:** diff --git a/README_CN.md b/README_CN.md index e09bc29..314dd5b 100644 --- a/README_CN.md +++ b/README_CN.md @@ -73,6 +73,7 @@ class Foo { ### WasmJS +> [!warning] > 从 `v0.6.0` 开始支持,实验中,不成熟、不稳定。 ```kotlin @@ -257,6 +258,13 @@ suspendTransform { Gradle JVM 必须满足 JDK11+ +### K2 + +K2 编译器从 `v0.7.0` 开始支持。 + +> [!warning] +> 实验中。 + ## 效果 **源代码:** From 3ab334f5f38f25066037891e10ad5ab7987b5106 Mon Sep 17 00:00:00 2001 From: ForteScarlet Date: Thu, 25 Jan 2024 22:57:58 +0800 Subject: [PATCH 6/8] TestRunner Generated --- .../runners/CodeGenTestRunnerGenerated.java | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 compiler/suspend-transform-plugin/src/test-gen/love/forte/plugin/suspendtrans/runners/CodeGenTestRunnerGenerated.java diff --git a/compiler/suspend-transform-plugin/src/test-gen/love/forte/plugin/suspendtrans/runners/CodeGenTestRunnerGenerated.java b/compiler/suspend-transform-plugin/src/test-gen/love/forte/plugin/suspendtrans/runners/CodeGenTestRunnerGenerated.java new file mode 100644 index 0000000..b5f7e7d --- /dev/null +++ b/compiler/suspend-transform-plugin/src/test-gen/love/forte/plugin/suspendtrans/runners/CodeGenTestRunnerGenerated.java @@ -0,0 +1,46 @@ + + +package love.forte.plugin.suspendtrans.runners; + +import com.intellij.testFramework.TestDataPath; +import org.jetbrains.kotlin.test.TestMetadata; +import org.jetbrains.kotlin.test.util.KtTestUtil; +import org.junit.jupiter.api.Test; + +import java.io.File; +import java.util.regex.Pattern; + +/** This class is generated by {@link love.forte.plugin.suspendtrans.GenerateTestsKt}. DO NOT MODIFY MANUALLY */ +@SuppressWarnings("all") +@TestMetadata("src/testData/codegen") +@TestDataPath("$PROJECT_ROOT") +public class CodeGenTestRunnerGenerated extends AbstractCodeGenTestRunner { + @Test + public void testAllFilesPresentInCodegen() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("src/testData/codegen"), Pattern.compile("^(.+)\\.kt$"), null, true); + } + + @Test + @TestMetadata("asProperty.kt") + public void testAsProperty() throws Exception { + runTest("src/testData/codegen/asProperty.kt"); + } + + @Test + @TestMetadata("basic.kt") + public void testBasic() throws Exception { + runTest("src/testData/codegen/basic.kt"); + } + + @Test + @TestMetadata("override.kt") + public void testOverride() throws Exception { + runTest("src/testData/codegen/override.kt"); + } + + @Test + @TestMetadata("typeAttr.kt") + public void testTypeAttr() throws Exception { + runTest("src/testData/codegen/typeAttr.kt"); + } +} From a82de5a1f70d885466a52351cf8346c9f6e6f4d8 Mon Sep 17 00:00:00 2001 From: ForteScarlet Date: Fri, 26 Jan 2024 02:37:02 +0800 Subject: [PATCH 7/8] Try to support K2 --- buildSrc/src/main/kotlin/IProject.kt | 2 +- .../suspend-transform-plugin/build.gradle.kts | 8 + .../fir/SuspendTransformFirTransformer.kt | 161 +++++++---- .../ir/SuspendTransformTransformer.kt | 28 +- .../utils/AnnotationDescriptorUtils.kt | 11 +- .../src/testData/codegen/asProperty.asm.txt | 78 +++-- .../testData/codegen/asProperty.fir.ir.txt | 270 +++++++++++------- .../src/testData/codegen/asProperty.fir.txt | 45 +-- .../src/testData/codegen/asProperty.kt | 18 +- .../src/testData/codegen/basic.fir.ir.txt | 20 +- .../src/testData/codegen/override.fir.ir.txt | 15 +- .../src/testData/codegen/typeAttr.fir.ir.txt | 7 +- gradle/libs.versions.toml | 5 +- .../suspendtrans/runtime/RunInSuspendJvm.kt | 8 +- samples/sample-jvm/build.gradle.kts | 14 +- .../suspendtrans/sample/ForteScarlet.kt | 32 ++- .../src/test/kotlin/SuspendTransformTests.kt | 152 ++++++++++ samples/sample-wasmJs/build.gradle.kts | 1 - settings.gradle.kts | 2 +- 19 files changed, 632 insertions(+), 245 deletions(-) create mode 100644 samples/sample-jvm/src/test/kotlin/SuspendTransformTests.kt diff --git a/buildSrc/src/main/kotlin/IProject.kt b/buildSrc/src/main/kotlin/IProject.kt index e6fba79..c8511da 100644 --- a/buildSrc/src/main/kotlin/IProject.kt +++ b/buildSrc/src/main/kotlin/IProject.kt @@ -9,7 +9,7 @@ object IProject : ProjectDetail() { const val DESCRIPTION = "Generate platform-compatible functions for Kotlin suspend functions" const val HOMEPAGE = "https://github.com/ForteScarlet/kotlin-suspend-transform-compiler-plugin" - override val version: Version = version(0, 7, 0) - version("beta1") + override val version: Version = version(0, 7, 0) - version("dev2") override val homepage: String get() = HOMEPAGE diff --git a/compiler/suspend-transform-plugin/build.gradle.kts b/compiler/suspend-transform-plugin/build.gradle.kts index bc8c982..2bef807 100644 --- a/compiler/suspend-transform-plugin/build.gradle.kts +++ b/compiler/suspend-transform-plugin/build.gradle.kts @@ -50,6 +50,14 @@ compileKotlin.kotlinOptions.freeCompilerArgs += listOf( "-opt-in=org.jetbrains.kotlin.ir.symbols.UnsafeDuringIrConstructionAPI", ) +tasks.withType(KotlinCompile::class.java).configureEach { + // see https://youtrack.jetbrains.com/issue/KTIJ-21563 + // see https://youtrack.jetbrains.com/issue/KT-57297 +// kotlinOptions { +// languageVersion = "1.9" +// apiVersion = "1.9" +// } +} repositories { maven { diff --git a/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt b/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt index 906fdff..9df1815 100644 --- a/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt +++ b/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt @@ -34,6 +34,7 @@ import org.jetbrains.kotlin.fir.symbols.impl.FirNamedFunctionSymbol import org.jetbrains.kotlin.fir.symbols.impl.FirPropertyAccessorSymbol import org.jetbrains.kotlin.fir.symbols.impl.FirPropertySymbol import org.jetbrains.kotlin.fir.types.* +import org.jetbrains.kotlin.fir.types.builder.buildErrorTypeRef import org.jetbrains.kotlin.fir.types.builder.buildResolvedTypeRef import org.jetbrains.kotlin.name.CallableId import org.jetbrains.kotlin.name.ClassId @@ -122,10 +123,10 @@ class SuspendTransformFirTransformer( origin = SuspendTransformPluginKey( data = SuspendTransformUserDataFir( - originSymbol = symbol.asOriginSymbol( - typeParameters = typeParameters, - valueParameters = valueParameters, - returnType.coneTypeOrNull?.classId + originSymbol = originFunc.symbol.asOriginSymbol( + typeParameters = originFunc.typeParameters, + valueParameters = originFunc.valueParameters, + originFunc.returnTypeRef.coneTypeOrNull?.classId ), asProperty = false, transformer = funData.transformer @@ -161,67 +162,113 @@ class SuspendTransformFirTransformer( val (functionAnnotations, propertyAnnotations) = copyAnnotations(original, funData) - val p = buildProperty { +// val p = createMemberProperty() +// owner = owner, +// key = SuspendTransformPluginKey( +// data = SuspendTransformUserDataFir( +// originSymbol = original.symbol.asOriginSymbol( +// typeParameters = original.typeParameters, +// valueParameters = original.valueParameters, +// original.returnTypeRef.coneTypeOrNull?.classId +// ), +// asProperty = true, +// transformer = funData.transformer +// ) +// ), +// name = callableId.callableName, +// returnTypeProvider = { resolveReturnConeType(original, funData) }, +// isVal = true, +// hasBackingField = false, +// ) { +// modality = original.syntheticModifier ?: Modality.FINAL +// // TODO receiver? +//// val receiverType = original.receiverParameter?.typeRef?.coneTypeOrNull +//// if (receiverType != null) { +//// extensionReceiverType(receiverType) +//// } +// } + + val pSymbol = FirPropertySymbol(callableId) + val pKey = SuspendTransformPluginKey( + data = SuspendTransformUserDataFir( + originSymbol = original.symbol.asOriginSymbol( + typeParameters = original.typeParameters, + valueParameters = original.valueParameters, + original.returnTypeRef.coneTypeOrNull?.classId + ), + asProperty = true, + transformer = funData.transformer + ) + ) + + val returnType = resolveReturnType(original, funData) + + val p1 = buildProperty { + symbol = pSymbol name = callableId.callableName - symbol = FirPropertySymbol(callableId) source = original.source resolvePhase = original.resolvePhase moduleData = original.moduleData - origin = original.origin + origin = pKey.origin attributes = original.attributes.copy() status = original.status.copy( isSuspend = false, + isFun = false, + isInner = false, // modality = if (original.status.isOverride) Modality.OPEN else original.status.modality, modality = original.syntheticModifier, ) - returnTypeRef = original.returnTypeRef - deprecationsProvider = original.deprecationsProvider + isVar = false + isLocal = false + returnTypeRef = returnType + deprecationsProvider = UnresolvedDeprecationProvider //original.deprecationsProvider containerSource = original.containerSource dispatchReceiverType = original.dispatchReceiverType contextReceivers.addAll(original.contextReceivers) // annotations annotations.addAll(propertyAnnotations) typeParameters.addAll(original.typeParameters) + resolvePhase = FirResolvePhase.BODY_RESOLVE + backingField = null + bodyResolveState = FirPropertyBodyResolveState.NOTHING_RESOLVED + getter = buildPropertyAccessor { + propertySymbol = pSymbol symbol = FirPropertyAccessorSymbol() - source = original.source - resolvePhase = original.resolvePhase + isGetter = true + resolvePhase = FirResolvePhase.BODY_RESOLVE moduleData = original.moduleData + // annotations annotations.addAll(functionAnnotations) - val returnType = resolveReturnType(original, funData) - returnTypeRef = returnType - origin = SuspendTransformPluginKey( - data = SuspendTransformUserDataFir( - originSymbol = symbol.asOriginSymbol( - typeParameters = typeParameters, - valueParameters = valueParameters, - returnType.coneTypeOrNull?.classId - ), - asProperty = true, - transformer = funData.transformer - ) - ).origin - - attributes = original.attributes.copy() - status = original.status + origin = pKey.origin + +// attributes = original.attributes.copy() + status = original.status.copy( + isSuspend = false, + isFun = false, + isInner = false, + modality = original.syntheticModifier, +// visibility = this@buildProperty.status + ) returnTypeRef = original.returnTypeRef - deprecationsProvider = original.deprecationsProvider - containerSource = original.containerSource - dispatchReceiverType = original.dispatchReceiverType - contextReceivers.addAll(original.contextReceivers) +// deprecationsProvider = original.deprecationsProvider +// containerSource = original.containerSource +// dispatchReceiverType = original.dispatchReceiverType +// contextReceivers.addAll(original.contextReceivers) valueParameters.addAll(original.valueParameters) - body = original.body - contractDescription = original.contractDescription - annotations.addAll(original.annotations) // TODO +// body = null +// contractDescription = original.contractDescription + // annotations + annotations.addAll(functionAnnotations) typeParameters.addAll(original.typeParameters) } } - propList.add(p.symbol) + propList.add(p1.symbol) } } @@ -275,7 +322,6 @@ class SuspendTransformFirTransformer( declaredScope.processAllFunctions { func -> if (!func.isSuspend) return@processAllFunctions -// if (!func.visibility.isPublicAPI) return@processAllFunctions val functionName = func.name.asString() suspendTransformConfiguration.transformers.asSequence() @@ -294,7 +340,11 @@ class SuspendTransformFirTransformer( ).firstOrNull() ?: continue - // TODO 读不到注解的参数? + + // 读不到注解的参数? + // 必须使用 anno.getXxxArgument(Name(argument name)), + // 使用 argumentMapping.mapping 获取不到结果 +// println("RAW AnnoData: ${anno.argumentMapping.mapping}") val annoData = TransformAnnotationData.of( firAnnotation = anno, @@ -316,15 +366,29 @@ class SuspendTransformFirTransformer( } private fun resolveReturnType(original: FirSimpleFunction, funData: FunData): FirTypeRef { - val originalReturnTypeRef = original.returnTypeRef + val resultConeType = resolveReturnConeType(original, funData) + + return if (resultConeType is ConeErrorType) { + buildErrorTypeRef { + diagnostic = resultConeType.diagnostic + type = resultConeType + } + } else { + buildResolvedTypeRef { + type = resultConeType + } + } + } + + private fun resolveReturnConeType(original: FirSimpleFunction, funData: FunData): ConeKotlinType { val transformer = funData.transformer val returnType = transformer.transformReturnType - ?: return originalReturnTypeRef + ?: return original.symbol.resolvedReturnType var typeArguments: Array = emptyArray() if (transformer.transformReturnTypeGeneric) { - typeArguments = arrayOf(ConeKotlinTypeProjectionOut(originalReturnTypeRef.coneType)) + typeArguments = arrayOf(ConeKotlinTypeProjectionOut(original.returnTypeRef.coneType)) } val resultConeType = returnType.toClassId().createConeType( @@ -333,12 +397,9 @@ class SuspendTransformFirTransformer( nullable = returnType.nullable ) - return buildResolvedTypeRef { - type = resultConeType - } + return resultConeType } - /** * @return function annotations `to` property annotations. */ @@ -366,7 +427,7 @@ class SuspendTransformFirTransformer( } // try add @Generated(by = ...) - runCatching { +// runCatching { // val generatedAnnotation = buildAnnotation { // annotationTypeRef = buildResolvedTypeRef { // type = generatedAnnotationClassId.createConeType(session) @@ -376,16 +437,14 @@ class SuspendTransformFirTransformer( // } // } // add(generatedAnnotation) - }.getOrElse { e -> - // Where is log? - e.printStackTrace() - } +// }.getOrElse { e -> +// // Where is log? +// e.printStackTrace() +// } // add includes includes.forEach { include -> val classId = include.classId - println("!!!include: $include") - println("!!!include: $classId") val includeAnnotation = buildAnnotation { argumentMapping = buildAnnotationArgumentMapping() annotationTypeRef = buildResolvedTypeRef { diff --git a/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/ir/SuspendTransformTransformer.kt b/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/ir/SuspendTransformTransformer.kt index 2e357db..9a4721f 100644 --- a/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/ir/SuspendTransformTransformer.kt +++ b/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/ir/SuspendTransformTransformer.kt @@ -53,16 +53,26 @@ class SuspendTransformTransformer( @OptIn(ObsoleteDescriptorBasedAPI::class) override fun visitPropertyNew(declaration: IrProperty): IrStatement { val getter = declaration.getter ?: return super.visitPropertyNew(declaration) - resolveFunctionBodyByDescriptor(getter, declaration.descriptor) + resolveFunctionBodyByDescriptor(getter, declaration.descriptor, declaration) return super.visitPropertyNew(declaration) } @OptIn(ObsoleteDescriptorBasedAPI::class) - private fun resolveFunctionBodyByDescriptor(declaration: IrFunction, descriptor: CallableDescriptor): IrFunction? { + private fun resolveFunctionBodyByDescriptor( + declaration: IrFunction, + descriptor: CallableDescriptor, + property: IrProperty? = null + ): IrFunction? { // K2 - val pluginKey = (declaration.origin as? IrDeclarationOrigin.GeneratedByPlugin) - ?.pluginKey as? SuspendTransformPluginKey + val pluginKey = if (property != null) { + // from property + (property.origin as? IrDeclarationOrigin.GeneratedByPlugin) + ?.pluginKey as? SuspendTransformPluginKey + } else { + (declaration.origin as? IrDeclarationOrigin.GeneratedByPlugin) + ?.pluginKey as? SuspendTransformPluginKey + } // K1 ? val userData = descriptor.getUserData(SuspendTransformUserDataKey) @@ -76,9 +86,15 @@ class SuspendTransformTransformer( resolveFunctionBody( declaration, - { f -> pluginKey.data.originSymbol.checkSame(f).also { println("Check result: $it: ($f(${f.name}) same ${pluginKey.data.originSymbol})") } }, + { f -> + pluginKey.data.originSymbol.checkSame(f) + }, callableFunction )?.also { generatedOriginFunction -> + if (property != null) { + // NO! BACKING! FIELD! + property.backingField = null + } postProcessGenerateOriginFunction( generatedOriginFunction, pluginKey.data.transformer.originFunctionIncludeAnnotations @@ -145,7 +161,7 @@ class SuspendTransformTransformer( if (originFunctions.size != 1) { val message = - "Transform function $function (${function.name}) 's originFunctions.size should be 1, but ${originFunctions.size} (findIn = ${(parent as? IrDeclaration)?.descriptor}, originFunctions = $originFunctions)" + "Synthetic function $function (${function.name}) 's originFunctions.size should be 1, but ${originFunctions.size} (findIn = ${(parent as? IrDeclaration)?.descriptor}, originFunctions = $originFunctions)" val location = when (val sourceLocation = function.getSourceLocation(runCatching { function.fileEntry }.getOrNull())) { diff --git a/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/utils/AnnotationDescriptorUtils.kt b/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/utils/AnnotationDescriptorUtils.kt index ab810ba..65887f1 100644 --- a/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/utils/AnnotationDescriptorUtils.kt +++ b/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/utils/AnnotationDescriptorUtils.kt @@ -7,6 +7,8 @@ import love.forte.plugin.suspendtrans.toJvmBlockingAnnotationName import org.jetbrains.kotlin.descriptors.DeclarationDescriptor import org.jetbrains.kotlin.descriptors.FunctionDescriptor import org.jetbrains.kotlin.descriptors.annotations.AnnotationDescriptor +import org.jetbrains.kotlin.fir.declarations.getBooleanArgument +import org.jetbrains.kotlin.fir.declarations.getStringArgument import org.jetbrains.kotlin.fir.expressions.FirAnnotation import org.jetbrains.kotlin.ir.builders.IrBuilderWithScope import org.jetbrains.kotlin.ir.builders.irCall @@ -96,15 +98,12 @@ data class TransformAnnotationData( defaultAsProperty: Boolean, ): TransformAnnotationData { - val baseName = firAnnotation.argumentMapping.mapping[Name.identifier(annotationBaseNamePropertyName)] - ?.accept(AbstractFirAnnotationArgumentVoidDataVisitor.nullableString, null) + val baseName = firAnnotation.getStringArgument(Name.identifier(annotationBaseNamePropertyName)) ?.takeIf { it.isNotEmpty() } - val suffix = firAnnotation.argumentMapping.mapping[Name.identifier(annotationSuffixPropertyName)] - ?.accept(AbstractFirAnnotationArgumentVoidDataVisitor.nullableString, null) + val suffix = firAnnotation.getStringArgument(Name.identifier(annotationSuffixPropertyName)) - val rawAsProperty = firAnnotation.argumentMapping.mapping[Name.identifier(annotationAsPropertyPropertyName)] - ?.accept(AbstractFirAnnotationArgumentVoidDataVisitor.nullableBoolean, null) + val rawAsProperty = firAnnotation.getBooleanArgument(Name.identifier(annotationAsPropertyPropertyName)) val functionName = "${baseName ?: defaultBaseName}${suffix ?: defaultSuffix}" diff --git a/compiler/suspend-transform-plugin/src/testData/codegen/asProperty.asm.txt b/compiler/suspend-transform-plugin/src/testData/codegen/asProperty.asm.txt index 345f003..5787c0a 100644 --- a/compiler/suspend-transform-plugin/src/testData/codegen/asProperty.asm.txt +++ b/compiler/suspend-transform-plugin/src/testData/codegen/asProperty.asm.txt @@ -1,9 +1,15 @@ -final class PropFoo$ageAsync$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { +public final class IProp$DefaultImpls : java/lang/Object { + public static java.lang.String getProp(IProp $this) + + public static java.util.concurrent.CompletableFuture getPropAsync(IProp $this) +} + +final class IProp$prop$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { int label - final PropFoo this$0 + final IProp this$0 - void (PropFoo $receiver, kotlin.coroutines.Continuation $completion) + void (IProp $receiver, kotlin.coroutines.Continuation $completion) public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) @@ -14,12 +20,12 @@ final class PropFoo$ageAsync$1 : kotlin/coroutines/jvm/internal/SuspendLambda, k public final java.lang.Object invokeSuspend(java.lang.Object $result) } -final class PropFoo$ageBlocking$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { +final class IProp$propAsync$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { int label - final PropFoo this$0 + final IProp this$0 - void (PropFoo $receiver, kotlin.coroutines.Continuation $completion) + void (IProp $receiver, kotlin.coroutines.Continuation $completion) public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) @@ -30,7 +36,15 @@ final class PropFoo$ageBlocking$1 : kotlin/coroutines/jvm/internal/SuspendLambda public final java.lang.Object invokeSuspend(java.lang.Object $result) } -final class PropFoo$propAsync$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { +public abstract interface IProp : java/lang/Object { + public abstract java.lang.String getProp() + + public abstract java.util.concurrent.CompletableFuture getPropAsync() + + public abstract java.lang.Object prop(kotlin.coroutines.Continuation p0) +} + +final class PropFoo$prop$2 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { int label final PropFoo this$0 @@ -46,7 +60,7 @@ final class PropFoo$propAsync$1 : kotlin/coroutines/jvm/internal/SuspendLambda, public final java.lang.Object invokeSuspend(java.lang.Object $result) } -final class PropFoo$propBlocking$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { +final class PropFoo$propAsync$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { int label final PropFoo this$0 @@ -65,19 +79,51 @@ final class PropFoo$propBlocking$1 : kotlin/coroutines/jvm/internal/SuspendLambd public final class PropFoo : java/lang/Object { public void () - public final java.lang.Object age(kotlin.coroutines.Continuation $completion) - - public final java.util.concurrent.CompletableFuture ageAsync() + public final java.lang.String getProp() - public final int ageBlocking() + public final java.util.concurrent.CompletableFuture getPropAsync() public final java.lang.Object prop(kotlin.coroutines.Continuation $completion) +} + +final class PropImpl$prop$2 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + int label + + final PropImpl this$0 + + void (PropImpl $receiver, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) - public final java.util.concurrent.CompletableFuture propAsync() + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) - public final java.lang.String propBlocking() + public final java.lang.Object invokeSuspend(java.lang.Object $result) } -public abstract interface TA : java/lang/Object, java/lang/annotation/Annotation { - public abstract java.lang.String value() +final class PropImpl$propAsync$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + int label + + final PropImpl this$0 + + void (PropImpl $receiver, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +public final class PropImpl : java/lang/Object, IProp { + public void () + + public java.lang.String getProp() + + public java.util.concurrent.CompletableFuture getPropAsync() + + public java.lang.Object prop(kotlin.coroutines.Continuation $completion) } diff --git a/compiler/suspend-transform-plugin/src/testData/codegen/asProperty.fir.ir.txt b/compiler/suspend-transform-plugin/src/testData/codegen/asProperty.fir.ir.txt index a908a0b..3c8b819 100644 --- a/compiler/suspend-transform-plugin/src/testData/codegen/asProperty.fir.ir.txt +++ b/compiler/suspend-transform-plugin/src/testData/codegen/asProperty.fir.ir.txt @@ -1,136 +1,202 @@ FILE fqName: fileName:/Main.kt - CLASS ANNOTATION_CLASS name:TA modality:OPEN visibility:public superTypes:[kotlin.Annotation] - $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.TA - CONSTRUCTOR visibility:public <> (value:kotlin.String) returnType:.TA [primary] - VALUE_PARAMETER name:value index:0 type:kotlin.String - EXPRESSION_BODY - CONST String type=kotlin.String value="forte" + CLASS CLASS name:PropFoo modality:FINAL visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.PropFoo + CONSTRUCTOR visibility:public <> () returnType:.PropFoo [primary] BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'public constructor () declared in kotlin.Any' - INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ANNOTATION_CLASS name:TA modality:OPEN visibility:public superTypes:[kotlin.Annotation]' - PROPERTY name:value visibility:public modality:FINAL [val] - FIELD PROPERTY_BACKING_FIELD name:value type:kotlin.String visibility:private [final] - EXPRESSION_BODY - GET_VAR 'value: kotlin.String declared in .TA.' type=kotlin.String origin=INITIALIZE_PROPERTY_FROM_PARAMETER - FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.TA) returnType:kotlin.String - correspondingProperty: PROPERTY name:value visibility:public modality:FINAL [val] - $this: VALUE_PARAMETER name: type:.TA + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:PropFoo modality:FINAL visibility:public superTypes:[kotlin.Any]' + FUN name:prop visibility:public modality:FINAL <> ($this:.PropFoo) returnType:kotlin.String [suspend] + annotations: + JvmBlocking(baseName = , suffix = '', asProperty = 'true') + JvmAsync(baseName = , suffix = , asProperty = 'true') + JvmSynthetic + $this: VALUE_PARAMETER name: type:.PropFoo + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun prop (): kotlin.String declared in .PropFoo' + CONST String type=kotlin.String value="" + PROPERTY GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:prop visibility:public modality:FINAL [val] + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name: visibility:public modality:FINAL <> ($this:.PropFoo) returnType:kotlin.String + annotations: + JvmAsync(baseName = , suffix = , asProperty = 'true') + Api4J + JvmAsync(baseName = , suffix = , asProperty = 'true') + Api4J + correspondingProperty: PROPERTY GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:prop visibility:public modality:FINAL [val] + $this: VALUE_PARAMETER name: type:.PropFoo BLOCK_BODY - RETURN type=kotlin.Nothing from='public final fun (): kotlin.String declared in .TA' - GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:value type:kotlin.String visibility:private [final]' type=kotlin.String origin=null - receiver: GET_VAR ': .TA declared in .TA.' type=.TA origin=null + RETURN type=kotlin.Nothing from='public final fun (): kotlin.String declared in .PropFoo' + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.String [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .PropFoo.' + CALL 'public final fun prop (): kotlin.String declared in .PropFoo' type=kotlin.String origin=null + $this: GET_VAR ': .PropFoo declared in .PropFoo.' type=.PropFoo origin=null + PROPERTY GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:propAsync visibility:public modality:FINAL [val] + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name: visibility:public modality:FINAL <> ($this:.PropFoo) returnType:java.util.concurrent.CompletableFuture + annotations: + JvmBlocking(baseName = , suffix = '', asProperty = 'true') + Api4J + JvmBlocking(baseName = , suffix = '', asProperty = 'true') + Api4J + correspondingProperty: PROPERTY GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:propAsync visibility:public modality:FINAL [val] + $this: VALUE_PARAMETER name: type:.PropFoo + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun (): java.util.concurrent.CompletableFuture declared in .PropFoo' + CALL 'public final fun $runInAsync$ (block: kotlin.coroutines.SuspendFunction0, scope: kotlinx.coroutines.CoroutineScope?): java.util.concurrent.CompletableFuture declared in love.forte.plugin.suspendtrans.runtime' type=java.util.concurrent.CompletableFuture origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:java.util.concurrent.CompletableFuture [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): java.util.concurrent.CompletableFuture declared in .PropFoo.' + CALL 'public final fun prop (): kotlin.String declared in .PropFoo' type=kotlin.String origin=null + $this: GET_VAR ': .PropFoo declared in .PropFoo.' type=.PropFoo origin=null FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] overridden: - public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Annotation + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any $this: VALUE_PARAMETER name: type:kotlin.Any VALUE_PARAMETER name:other index:0 type:kotlin.Any? FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] overridden: - public open fun hashCode (): kotlin.Int declared in kotlin.Annotation + public open fun hashCode (): kotlin.Int declared in kotlin.Any $this: VALUE_PARAMETER name: type:kotlin.Any FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] overridden: - public open fun toString (): kotlin.String declared in kotlin.Annotation + public open fun toString (): kotlin.String declared in kotlin.Any $this: VALUE_PARAMETER name: type:kotlin.Any - CLASS CLASS name:PropFoo modality:FINAL visibility:public superTypes:[kotlin.Any] - $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.PropFoo - CONSTRUCTOR visibility:public <> () returnType:.PropFoo [primary] - BLOCK_BODY - DELEGATING_CONSTRUCTOR_CALL 'public constructor () declared in kotlin.Any' - INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:PropFoo modality:FINAL visibility:public superTypes:[kotlin.Any]' - FUN name:prop visibility:public modality:FINAL <> ($this:.PropFoo) returnType:kotlin.String [suspend] + CLASS INTERFACE name:IProp modality:ABSTRACT visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.IProp + FUN name:prop visibility:public modality:ABSTRACT <> ($this:.IProp) returnType:kotlin.String [suspend] annotations: JvmBlocking(baseName = , suffix = '', asProperty = 'true') JvmAsync(baseName = , suffix = , asProperty = 'true') - TA(value = 'forliy') - $this: VALUE_PARAMETER name: type:.PropFoo - BLOCK_BODY - RETURN type=kotlin.Nothing from='public final fun prop (): kotlin.String declared in .PropFoo' - CONST String type=kotlin.String value="" - FUN name:age visibility:public modality:FINAL <> ($this:.PropFoo) returnType:kotlin.Int [suspend] - annotations: - JvmBlocking(baseName = , suffix = , asProperty = ) - JvmAsync(baseName = , suffix = , asProperty = ) - $this: VALUE_PARAMETER name: type:.PropFoo - BLOCK_BODY - RETURN type=kotlin.Nothing from='public final fun age (): kotlin.Int declared in .PropFoo' - CONST Int type=kotlin.Int value=1 - FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:ageBlocking visibility:public modality:FINAL <> ($this:.PropFoo) returnType:kotlin.Int - annotations: - JvmAsync(baseName = , suffix = , asProperty = ) - Api4J JvmSynthetic - $this: VALUE_PARAMETER name: type:.PropFoo - BLOCK_BODY - RETURN type=kotlin.Nothing from='public final fun ageBlocking (): kotlin.Int declared in .PropFoo' - CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null - : - block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Int [suspend] - BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): kotlin.Int declared in .PropFoo.ageBlocking' - CALL 'public final fun ageBlocking (): kotlin.Int declared in .PropFoo' type=kotlin.Int origin=null - $this: GET_VAR ': .PropFoo declared in .PropFoo.ageBlocking' type=.PropFoo origin=null - FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:ageAsync visibility:public modality:FINAL <> ($this:.PropFoo) returnType:java.util.concurrent.CompletableFuture - annotations: - JvmBlocking(baseName = , suffix = , asProperty = ) - Api4J - JvmSynthetic - $this: VALUE_PARAMETER name: type:.PropFoo + $this: VALUE_PARAMETER name: type:.IProp + PROPERTY GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:prop visibility:public modality:OPEN [val] + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name: visibility:public modality:OPEN <> ($this:.IProp) returnType:kotlin.String + annotations: + JvmAsync(baseName = , suffix = , asProperty = 'true') + Api4J + JvmAsync(baseName = , suffix = , asProperty = 'true') + Api4J + correspondingProperty: PROPERTY GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:prop visibility:public modality:OPEN [val] + $this: VALUE_PARAMETER name: type:.IProp + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun (): kotlin.String declared in .IProp' + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.String [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .IProp.' + CALL 'public abstract fun prop (): kotlin.String declared in .IProp' type=kotlin.String origin=null + $this: GET_VAR ': .IProp declared in .IProp.' type=.IProp origin=null + PROPERTY GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:propAsync visibility:public modality:OPEN [val] + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name: visibility:public modality:OPEN <> ($this:.IProp) returnType:java.util.concurrent.CompletableFuture + annotations: + JvmBlocking(baseName = , suffix = '', asProperty = 'true') + Api4J + JvmBlocking(baseName = , suffix = '', asProperty = 'true') + Api4J + correspondingProperty: PROPERTY GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:propAsync visibility:public modality:OPEN [val] + $this: VALUE_PARAMETER name: type:.IProp + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun (): java.util.concurrent.CompletableFuture declared in .IProp' + CALL 'public final fun $runInAsync$ (block: kotlin.coroutines.SuspendFunction0, scope: kotlinx.coroutines.CoroutineScope?): java.util.concurrent.CompletableFuture declared in love.forte.plugin.suspendtrans.runtime' type=java.util.concurrent.CompletableFuture origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:java.util.concurrent.CompletableFuture [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): java.util.concurrent.CompletableFuture declared in .IProp.' + CALL 'public abstract fun prop (): kotlin.String declared in .IProp' type=kotlin.String origin=null + $this: GET_VAR ': .IProp declared in .IProp.' type=.IProp origin=null + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + CLASS CLASS name:PropImpl modality:FINAL visibility:public superTypes:[.IProp] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.PropImpl + CONSTRUCTOR visibility:public <> () returnType:.PropImpl [primary] BLOCK_BODY - RETURN type=kotlin.Nothing from='public final fun ageAsync (): java.util.concurrent.CompletableFuture declared in .PropFoo' - CALL 'public final fun $runInAsync$ (block: kotlin.coroutines.SuspendFunction0, scope: kotlinx.coroutines.CoroutineScope?): java.util.concurrent.CompletableFuture declared in love.forte.plugin.suspendtrans.runtime' type=java.util.concurrent.CompletableFuture origin=null - : - block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:java.util.concurrent.CompletableFuture [suspend] - BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): java.util.concurrent.CompletableFuture declared in .PropFoo.ageAsync' - CALL 'public final fun ageAsync (): java.util.concurrent.CompletableFuture declared in .PropFoo' type=java.util.concurrent.CompletableFuture origin=null - $this: GET_VAR ': .PropFoo declared in .PropFoo.ageAsync' type=.PropFoo origin=null - FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:propAsync visibility:public modality:FINAL <> ($this:.PropFoo) returnType:java.util.concurrent.CompletableFuture + DELEGATING_CONSTRUCTOR_CALL 'public constructor () declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:PropImpl modality:FINAL visibility:public superTypes:[.IProp]' + FUN name:prop visibility:public modality:OPEN <> ($this:.PropImpl) returnType:kotlin.String [suspend] annotations: JvmBlocking(baseName = , suffix = '', asProperty = 'true') - TA(value = 'forliy') - Api4J - JvmSynthetic - $this: VALUE_PARAMETER name: type:.PropFoo - BLOCK_BODY - RETURN type=kotlin.Nothing from='public final fun propAsync (): java.util.concurrent.CompletableFuture declared in .PropFoo' - CALL 'public final fun $runInAsync$ (block: kotlin.coroutines.SuspendFunction0, scope: kotlinx.coroutines.CoroutineScope?): java.util.concurrent.CompletableFuture declared in love.forte.plugin.suspendtrans.runtime' type=java.util.concurrent.CompletableFuture origin=null - : - block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:java.util.concurrent.CompletableFuture [suspend] - BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): java.util.concurrent.CompletableFuture declared in .PropFoo.propAsync' - CALL 'public final fun propAsync (): java.util.concurrent.CompletableFuture declared in .PropFoo' type=java.util.concurrent.CompletableFuture origin=null - $this: GET_VAR ': .PropFoo declared in .PropFoo.propAsync' type=.PropFoo origin=null - FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:propBlocking visibility:public modality:FINAL <> ($this:.PropFoo) returnType:kotlin.String - annotations: JvmAsync(baseName = , suffix = , asProperty = 'true') - TA(value = 'forliy') - Api4J JvmSynthetic - $this: VALUE_PARAMETER name: type:.PropFoo + overridden: + public abstract fun prop (): kotlin.String declared in .IProp + $this: VALUE_PARAMETER name: type:.PropImpl BLOCK_BODY - RETURN type=kotlin.Nothing from='public final fun propBlocking (): kotlin.String declared in .PropFoo' - CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null - : - block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.String [suspend] - BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .PropFoo.propBlocking' - CALL 'public final fun propBlocking (): kotlin.String declared in .PropFoo' type=kotlin.String origin=null - $this: GET_VAR ': .PropFoo declared in .PropFoo.propBlocking' type=.PropFoo origin=null + RETURN type=kotlin.Nothing from='public open fun prop (): kotlin.String declared in .PropImpl' + CONST String type=kotlin.String value="" + PROPERTY GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:prop visibility:public modality:OPEN [val] + overridden: + public open prop: kotlin.String + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name: visibility:public modality:OPEN <> ($this:.PropImpl) returnType:kotlin.String + annotations: + JvmAsync(baseName = , suffix = , asProperty = 'true') + Api4J + JvmAsync(baseName = , suffix = , asProperty = 'true') + Api4J + correspondingProperty: PROPERTY GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:prop visibility:public modality:OPEN [val] + overridden: + public open fun (): kotlin.String declared in .IProp + $this: VALUE_PARAMETER name: type:.PropImpl + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun (): kotlin.String declared in .PropImpl' + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.String [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .PropImpl.' + CALL 'public open fun prop (): kotlin.String declared in .PropImpl' type=kotlin.String origin=null + $this: GET_VAR ': .PropImpl declared in .PropImpl.' type=.PropImpl origin=null + PROPERTY GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:propAsync visibility:public modality:OPEN [val] + overridden: + public open propAsync: java.util.concurrent.CompletableFuture + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name: visibility:public modality:OPEN <> ($this:.PropImpl) returnType:java.util.concurrent.CompletableFuture + annotations: + JvmBlocking(baseName = , suffix = '', asProperty = 'true') + Api4J + JvmBlocking(baseName = , suffix = '', asProperty = 'true') + Api4J + correspondingProperty: PROPERTY GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:propAsync visibility:public modality:OPEN [val] + overridden: + public open fun (): java.util.concurrent.CompletableFuture declared in .IProp + $this: VALUE_PARAMETER name: type:.PropImpl + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun (): java.util.concurrent.CompletableFuture declared in .PropImpl' + CALL 'public final fun $runInAsync$ (block: kotlin.coroutines.SuspendFunction0, scope: kotlinx.coroutines.CoroutineScope?): java.util.concurrent.CompletableFuture declared in love.forte.plugin.suspendtrans.runtime' type=java.util.concurrent.CompletableFuture origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:java.util.concurrent.CompletableFuture [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): java.util.concurrent.CompletableFuture declared in .PropImpl.' + CALL 'public open fun prop (): kotlin.String declared in .PropImpl' type=kotlin.String origin=null + $this: GET_VAR ': .PropImpl declared in .PropImpl.' type=.PropImpl origin=null FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] overridden: - public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .IProp $this: VALUE_PARAMETER name: type:kotlin.Any VALUE_PARAMETER name:other index:0 type:kotlin.Any? FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] overridden: - public open fun hashCode (): kotlin.Int declared in kotlin.Any + public open fun hashCode (): kotlin.Int declared in .IProp $this: VALUE_PARAMETER name: type:kotlin.Any FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] overridden: - public open fun toString (): kotlin.String declared in kotlin.Any + public open fun toString (): kotlin.String declared in .IProp $this: VALUE_PARAMETER name: type:kotlin.Any diff --git a/compiler/suspend-transform-plugin/src/testData/codegen/asProperty.fir.txt b/compiler/suspend-transform-plugin/src/testData/codegen/asProperty.fir.txt index 24c28f3..1bb5efe 100644 --- a/compiler/suspend-transform-plugin/src/testData/codegen/asProperty.fir.txt +++ b/compiler/suspend-transform-plugin/src/testData/codegen/asProperty.fir.txt @@ -1,32 +1,43 @@ FILE: Main.kt - public final annotation class TA : R|kotlin/Annotation| { - public constructor(value: R|kotlin/String| = String(forte)): R|TA| { - super() - } - - public final val value: R|kotlin/String| = R|/value| - public get(): R|kotlin/String| - - } public final class PropFoo : R|kotlin/Any| { public constructor(): R|PropFoo| { super() } - @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|(asProperty = Boolean(true), suffix = String()) @R|love/forte/plugin/suspendtrans/annotation/JvmAsync|(asProperty = Boolean(true)) @R|TA|(value = String(forliy)) public final suspend fun prop(): R|kotlin/String| { + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|(asProperty = Boolean(true), suffix = String()) @R|love/forte/plugin/suspendtrans/annotation/JvmAsync|(asProperty = Boolean(true)) public final suspend fun prop(): R|kotlin/String| { ^prop String() } - @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/JvmAsync|() public final suspend fun age(): R|kotlin/Int| { - ^age Int(1) - } + public final val prop: R|kotlin/String| + @R|love/forte/plugin/suspendtrans/annotation/JvmAsync|(asProperty = Boolean(true)) @R|love/forte/plugin/suspendtrans/annotation/Api4J|() @R|love/forte/plugin/suspendtrans/annotation/JvmAsync|(asProperty = Boolean(true)) @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public get(): R|kotlin/String| + + public final val propAsync: R|java/util/concurrent/CompletableFuture| + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|(asProperty = Boolean(true), suffix = String()) @R|love/forte/plugin/suspendtrans/annotation/Api4J|() @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|(asProperty = Boolean(true), suffix = String()) @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public get(): R|kotlin/String| + + } + public abstract interface IProp : R|kotlin/Any| { + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|(asProperty = Boolean(true), suffix = String()) @R|love/forte/plugin/suspendtrans/annotation/JvmAsync|(asProperty = Boolean(true)) public abstract suspend fun prop(): R|kotlin/String| + + public open val prop: R|kotlin/String| + @R|love/forte/plugin/suspendtrans/annotation/JvmAsync|(asProperty = Boolean(true)) @R|love/forte/plugin/suspendtrans/annotation/Api4J|() @R|love/forte/plugin/suspendtrans/annotation/JvmAsync|(asProperty = Boolean(true)) @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public get(): R|kotlin/String| - @R|love/forte/plugin/suspendtrans/annotation/JvmAsync|() @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public final fun ageBlocking(): R|kotlin/Int| + public open val propAsync: R|java/util/concurrent/CompletableFuture| + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|(asProperty = Boolean(true), suffix = String()) @R|love/forte/plugin/suspendtrans/annotation/Api4J|() @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|(asProperty = Boolean(true), suffix = String()) @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public get(): R|kotlin/String| + + } + public final class PropImpl : R|IProp| { + public constructor(): R|PropImpl| { + super() + } - @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public final fun ageAsync(): R|java/util/concurrent/CompletableFuture| + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|(asProperty = Boolean(true), suffix = String()) @R|love/forte/plugin/suspendtrans/annotation/JvmAsync|(asProperty = Boolean(true)) public open override suspend fun prop(): R|kotlin/String| { + ^prop String() + } - @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|(asProperty = Boolean(true), suffix = String()) @R|TA|(value = String(forliy)) @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public final fun propAsync(): R|java/util/concurrent/CompletableFuture| + public open override val prop: R|kotlin/String| + @R|love/forte/plugin/suspendtrans/annotation/JvmAsync|(asProperty = Boolean(true)) @R|love/forte/plugin/suspendtrans/annotation/Api4J|() @R|love/forte/plugin/suspendtrans/annotation/JvmAsync|(asProperty = Boolean(true)) @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public get(): R|kotlin/String| - @R|love/forte/plugin/suspendtrans/annotation/JvmAsync|(asProperty = Boolean(true)) @R|TA|(value = String(forliy)) @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public final fun propBlocking(): R|kotlin/String| + public open override val propAsync: R|java/util/concurrent/CompletableFuture| + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|(asProperty = Boolean(true), suffix = String()) @R|love/forte/plugin/suspendtrans/annotation/Api4J|() @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|(asProperty = Boolean(true), suffix = String()) @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public get(): R|kotlin/String| } diff --git a/compiler/suspend-transform-plugin/src/testData/codegen/asProperty.kt b/compiler/suspend-transform-plugin/src/testData/codegen/asProperty.kt index 6d359a5..76013dc 100644 --- a/compiler/suspend-transform-plugin/src/testData/codegen/asProperty.kt +++ b/compiler/suspend-transform-plugin/src/testData/codegen/asProperty.kt @@ -7,15 +7,21 @@ import kotlinx.coroutines.runBlocking import love.forte.plugin.suspendtrans.annotation.JvmAsync import love.forte.plugin.suspendtrans.annotation.JvmBlocking -annotation class TA(val value: String = "forte") - class PropFoo { @love.forte.plugin.suspendtrans.annotation.JvmBlocking(asProperty = true, suffix = "") @love.forte.plugin.suspendtrans.annotation.JvmAsync(asProperty = true) - @TA(value = "forliy") suspend fun prop(): String = "" +} + - @JvmBlocking - @JvmAsync - suspend fun age(): Int = 1 +interface IProp { + @love.forte.plugin.suspendtrans.annotation.JvmBlocking(asProperty = true, suffix = "") + @love.forte.plugin.suspendtrans.annotation.JvmAsync(asProperty = true) + suspend fun prop(): String +} + +class PropImpl : IProp { + @love.forte.plugin.suspendtrans.annotation.JvmBlocking(asProperty = true, suffix = "") + @love.forte.plugin.suspendtrans.annotation.JvmAsync(asProperty = true) + override suspend fun prop(): String = "" } diff --git a/compiler/suspend-transform-plugin/src/testData/codegen/basic.fir.ir.txt b/compiler/suspend-transform-plugin/src/testData/codegen/basic.fir.ir.txt index f6979b9..5606f90 100644 --- a/compiler/suspend-transform-plugin/src/testData/codegen/basic.fir.ir.txt +++ b/compiler/suspend-transform-plugin/src/testData/codegen/basic.fir.ir.txt @@ -8,6 +8,7 @@ FILE fqName: fileName:/Main.kt FUN name:foo visibility:public modality:FINAL <> ($this:.BasicFoo) returnType:kotlin.String [suspend] annotations: JvmAsync(baseName = , suffix = , asProperty = ) + JvmSynthetic $this: VALUE_PARAMETER name: type:.BasicFoo BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun foo (): kotlin.String declared in .BasicFoo' @@ -15,7 +16,6 @@ FILE fqName: fileName:/Main.kt FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:fooAsync visibility:public modality:FINAL <> ($this:.BasicFoo) returnType:java.util.concurrent.CompletableFuture annotations: Api4J - JvmSynthetic $this: VALUE_PARAMETER name: type:.BasicFoo BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun fooAsync (): java.util.concurrent.CompletableFuture declared in .BasicFoo' @@ -25,7 +25,7 @@ FILE fqName: fileName:/Main.kt FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:java.util.concurrent.CompletableFuture [suspend] BLOCK_BODY RETURN type=kotlin.Nothing from='local final fun (): java.util.concurrent.CompletableFuture declared in .BasicFoo.fooAsync' - CALL 'public final fun fooAsync (): java.util.concurrent.CompletableFuture declared in .BasicFoo' type=java.util.concurrent.CompletableFuture origin=null + CALL 'public final fun foo (): kotlin.String declared in .BasicFoo' type=kotlin.String origin=null $this: GET_VAR ': .BasicFoo declared in .BasicFoo.fooAsync' type=.BasicFoo origin=null FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] overridden: @@ -49,6 +49,7 @@ FILE fqName: fileName:/Main.kt FUN name:bar visibility:public modality:FINAL <> ($this:.BasicBar) returnType:kotlin.String [suspend] annotations: JvmAsync(baseName = , suffix = , asProperty = ) + JvmSynthetic $this: VALUE_PARAMETER name: type:.BasicBar BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun bar (): kotlin.String declared in .BasicBar' @@ -56,6 +57,7 @@ FILE fqName: fileName:/Main.kt FUN name:bar2 visibility:public modality:FINAL <> ($this:.BasicBar, i:kotlin.Int) returnType:kotlin.String [suspend] annotations: JvmAsync(baseName = , suffix = , asProperty = ) + JvmSynthetic $this: VALUE_PARAMETER name: type:.BasicBar VALUE_PARAMETER name:i index:0 type:kotlin.Int BLOCK_BODY @@ -64,7 +66,6 @@ FILE fqName: fileName:/Main.kt FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:bar2Async visibility:public modality:FINAL <> ($this:.BasicBar, i:kotlin.Int) returnType:java.util.concurrent.CompletableFuture annotations: Api4J - JvmSynthetic $this: VALUE_PARAMETER name: type:.BasicBar VALUE_PARAMETER name:i index:0 type:kotlin.Int BLOCK_BODY @@ -75,13 +76,12 @@ FILE fqName: fileName:/Main.kt FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:java.util.concurrent.CompletableFuture [suspend] BLOCK_BODY RETURN type=kotlin.Nothing from='local final fun (): java.util.concurrent.CompletableFuture declared in .BasicBar.bar2Async' - CALL 'public final fun bar2Async (i: kotlin.Int): java.util.concurrent.CompletableFuture declared in .BasicBar' type=java.util.concurrent.CompletableFuture origin=null + CALL 'public final fun bar2 (i: kotlin.Int): kotlin.String declared in .BasicBar' type=kotlin.String origin=null $this: GET_VAR ': .BasicBar declared in .BasicBar.bar2Async' type=.BasicBar origin=null i: GET_VAR 'i: kotlin.Int declared in .BasicBar.bar2Async' type=kotlin.Int origin=null FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:barAsync visibility:public modality:FINAL <> ($this:.BasicBar) returnType:java.util.concurrent.CompletableFuture annotations: Api4J - JvmSynthetic $this: VALUE_PARAMETER name: type:.BasicBar BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun barAsync (): java.util.concurrent.CompletableFuture declared in .BasicBar' @@ -91,7 +91,7 @@ FILE fqName: fileName:/Main.kt FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:java.util.concurrent.CompletableFuture [suspend] BLOCK_BODY RETURN type=kotlin.Nothing from='local final fun (): java.util.concurrent.CompletableFuture declared in .BasicBar.barAsync' - CALL 'public final fun barAsync (): java.util.concurrent.CompletableFuture declared in .BasicBar' type=java.util.concurrent.CompletableFuture origin=null + CALL 'public final fun bar (): kotlin.String declared in .BasicBar' type=kotlin.String origin=null $this: GET_VAR ': .BasicBar declared in .BasicBar.barAsync' type=.BasicBar origin=null FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] overridden: @@ -111,10 +111,12 @@ FILE fqName: fileName:/Main.kt FUN name:bar visibility:public modality:ABSTRACT <> ($this:.InterfaceBar) returnType:kotlin.String [suspend] annotations: JvmAsync(baseName = , suffix = , asProperty = ) + JvmSynthetic $this: VALUE_PARAMETER name: type:.InterfaceBar FUN name:bar2 visibility:public modality:ABSTRACT <> ($this:.InterfaceBar, i:kotlin.Int) returnType:kotlin.String [suspend] annotations: JvmAsync(baseName = , suffix = , asProperty = ) + JvmSynthetic $this: VALUE_PARAMETER name: type:.InterfaceBar VALUE_PARAMETER name:i index:0 type:kotlin.Int FUN name:asyncBase visibility:public modality:ABSTRACT <> ($this:.InterfaceBar, i:kotlin.Int) returnType:.ResultValue @@ -123,7 +125,6 @@ FILE fqName: fileName:/Main.kt FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:bar2Async visibility:public modality:OPEN <> ($this:.InterfaceBar, i:kotlin.Int) returnType:java.util.concurrent.CompletableFuture annotations: Api4J - JvmSynthetic $this: VALUE_PARAMETER name: type:.InterfaceBar VALUE_PARAMETER name:i index:0 type:kotlin.Int BLOCK_BODY @@ -134,13 +135,12 @@ FILE fqName: fileName:/Main.kt FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:java.util.concurrent.CompletableFuture [suspend] BLOCK_BODY RETURN type=kotlin.Nothing from='local final fun (): java.util.concurrent.CompletableFuture declared in .InterfaceBar.bar2Async' - CALL 'public open fun bar2Async (i: kotlin.Int): java.util.concurrent.CompletableFuture declared in .InterfaceBar' type=java.util.concurrent.CompletableFuture origin=null + CALL 'public abstract fun bar2 (i: kotlin.Int): kotlin.String declared in .InterfaceBar' type=kotlin.String origin=null $this: GET_VAR ': .InterfaceBar declared in .InterfaceBar.bar2Async' type=.InterfaceBar origin=null i: GET_VAR 'i: kotlin.Int declared in .InterfaceBar.bar2Async' type=kotlin.Int origin=null FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:barAsync visibility:public modality:OPEN <> ($this:.InterfaceBar) returnType:java.util.concurrent.CompletableFuture annotations: Api4J - JvmSynthetic $this: VALUE_PARAMETER name: type:.InterfaceBar BLOCK_BODY RETURN type=kotlin.Nothing from='public open fun barAsync (): java.util.concurrent.CompletableFuture declared in .InterfaceBar' @@ -150,7 +150,7 @@ FILE fqName: fileName:/Main.kt FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:java.util.concurrent.CompletableFuture [suspend] BLOCK_BODY RETURN type=kotlin.Nothing from='local final fun (): java.util.concurrent.CompletableFuture declared in .InterfaceBar.barAsync' - CALL 'public open fun barAsync (): java.util.concurrent.CompletableFuture declared in .InterfaceBar' type=java.util.concurrent.CompletableFuture origin=null + CALL 'public abstract fun bar (): kotlin.String declared in .InterfaceBar' type=kotlin.String origin=null $this: GET_VAR ': .InterfaceBar declared in .InterfaceBar.barAsync' type=.InterfaceBar origin=null FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] overridden: diff --git a/compiler/suspend-transform-plugin/src/testData/codegen/override.fir.ir.txt b/compiler/suspend-transform-plugin/src/testData/codegen/override.fir.ir.txt index 0957c77..486cfa5 100644 --- a/compiler/suspend-transform-plugin/src/testData/codegen/override.fir.ir.txt +++ b/compiler/suspend-transform-plugin/src/testData/codegen/override.fir.ir.txt @@ -5,12 +5,13 @@ FILE fqName: fileName:/Main.kt JvmAsync(baseName = , suffix = , asProperty = ) $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.IFoo FUN name:run visibility:public modality:ABSTRACT <> ($this:.IFoo, n:kotlin.Int) returnType:.Bar [suspend] + annotations: + JvmSynthetic $this: VALUE_PARAMETER name: type:.IFoo VALUE_PARAMETER name:n index:0 type:kotlin.Int FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:runAsync visibility:public modality:OPEN <> ($this:.IFoo, n:kotlin.Int) returnType:java.util.concurrent.CompletableFuture annotations: Api4J - JvmSynthetic $this: VALUE_PARAMETER name: type:.IFoo VALUE_PARAMETER name:n index:0 type:kotlin.Int BLOCK_BODY @@ -21,13 +22,12 @@ FILE fqName: fileName:/Main.kt FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:java.util.concurrent.CompletableFuture [suspend] BLOCK_BODY RETURN type=kotlin.Nothing from='local final fun (): java.util.concurrent.CompletableFuture declared in .IFoo.runAsync' - CALL 'public open fun runAsync (n: kotlin.Int): java.util.concurrent.CompletableFuture declared in .IFoo' type=java.util.concurrent.CompletableFuture origin=null + CALL 'public abstract fun run (n: kotlin.Int): .Bar declared in .IFoo' type=.Bar origin=null $this: GET_VAR ': .IFoo declared in .IFoo.runAsync' type=.IFoo origin=null n: GET_VAR 'n: kotlin.Int declared in .IFoo.runAsync' type=kotlin.Int origin=null FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:runBlocking visibility:public modality:OPEN <> ($this:.IFoo, n:kotlin.Int) returnType:.Bar annotations: Api4J - JvmSynthetic $this: VALUE_PARAMETER name: type:.IFoo VALUE_PARAMETER name:n index:0 type:kotlin.Int BLOCK_BODY @@ -38,7 +38,7 @@ FILE fqName: fileName:/Main.kt FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:.Bar [suspend] BLOCK_BODY RETURN type=kotlin.Nothing from='local final fun (): .Bar declared in .IFoo.runBlocking' - CALL 'public open fun runBlocking (n: kotlin.Int): .Bar declared in .IFoo' type=.Bar origin=null + CALL 'public abstract fun run (n: kotlin.Int): .Bar declared in .IFoo' type=.Bar origin=null $this: GET_VAR ': .IFoo declared in .IFoo.runBlocking' type=.IFoo origin=null n: GET_VAR 'n: kotlin.Int declared in .IFoo.runBlocking' type=kotlin.Int origin=null FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] @@ -60,6 +60,7 @@ FILE fqName: fileName:/Main.kt annotations: JvmBlocking(baseName = , suffix = , asProperty = ) JvmAsync(baseName = , suffix = , asProperty = ) + JvmSynthetic $this: VALUE_PARAMETER name: type:.Foo FUN name:run visibility:public modality:OPEN <> ($this:.Foo, name:kotlin.String) returnType:.Tar [suspend] $this: VALUE_PARAMETER name: type:.Foo @@ -76,7 +77,6 @@ FILE fqName: fileName:/Main.kt annotations: JvmBlocking(baseName = , suffix = , asProperty = ) Api4J - JvmSynthetic $this: VALUE_PARAMETER name: type:.Foo BLOCK_BODY RETURN type=kotlin.Nothing from='public open fun runAsync (): java.util.concurrent.CompletableFuture declared in .Foo' @@ -86,13 +86,12 @@ FILE fqName: fileName:/Main.kt FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:java.util.concurrent.CompletableFuture [suspend] BLOCK_BODY RETURN type=kotlin.Nothing from='local final fun (): java.util.concurrent.CompletableFuture declared in .Foo.runAsync' - CALL 'public open fun runAsync (): java.util.concurrent.CompletableFuture declared in .Foo' type=java.util.concurrent.CompletableFuture origin=null + CALL 'public abstract fun run (): .Bar declared in .Foo' type=.Bar origin=null $this: GET_VAR ': .Foo declared in .Foo.runAsync' type=.Foo origin=null FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:runBlocking visibility:public modality:OPEN <> ($this:.Foo) returnType:.Bar annotations: JvmAsync(baseName = , suffix = , asProperty = ) Api4J - JvmSynthetic $this: VALUE_PARAMETER name: type:.Foo BLOCK_BODY RETURN type=kotlin.Nothing from='public open fun runBlocking (): .Bar declared in .Foo' @@ -102,7 +101,7 @@ FILE fqName: fileName:/Main.kt FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:.Bar [suspend] BLOCK_BODY RETURN type=kotlin.Nothing from='local final fun (): .Bar declared in .Foo.runBlocking' - CALL 'public open fun runBlocking (): .Bar declared in .Foo' type=.Bar origin=null + CALL 'public abstract fun run (): .Bar declared in .Foo' type=.Bar origin=null $this: GET_VAR ': .Foo declared in .Foo.runBlocking' type=.Foo origin=null FUN FAKE_OVERRIDE name:runAsync visibility:public modality:OPEN <> ($this:.IFoo, n:kotlin.Int) returnType:java.util.concurrent.CompletableFuture [fake_override] annotations: diff --git a/compiler/suspend-transform-plugin/src/testData/codegen/typeAttr.fir.ir.txt b/compiler/suspend-transform-plugin/src/testData/codegen/typeAttr.fir.ir.txt index 7a35dc2..a81c220 100644 --- a/compiler/suspend-transform-plugin/src/testData/codegen/typeAttr.fir.ir.txt +++ b/compiler/suspend-transform-plugin/src/testData/codegen/typeAttr.fir.ir.txt @@ -44,12 +44,12 @@ FILE fqName: fileName:/Main.kt annotations: JvmBlocking(baseName = , suffix = , asProperty = ) JvmAsync(baseName = , suffix = , asProperty = ) + JvmSynthetic $this: VALUE_PARAMETER name: type:.Foo.Foo> FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:valueAsync visibility:public modality:OPEN <> ($this:.Foo.Foo>) returnType:java.util.concurrent.CompletableFuture annotations: JvmBlocking(baseName = , suffix = , asProperty = ) Api4J - JvmSynthetic $this: VALUE_PARAMETER name: type:.Foo.Foo> BLOCK_BODY RETURN type=kotlin.Nothing from='public open fun valueAsync (): java.util.concurrent.CompletableFuture declared in .Foo' @@ -59,13 +59,12 @@ FILE fqName: fileName:/Main.kt FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:java.util.concurrent.CompletableFuture [suspend] BLOCK_BODY RETURN type=kotlin.Nothing from='local final fun (): java.util.concurrent.CompletableFuture declared in .Foo.valueAsync' - CALL 'public open fun valueAsync (): java.util.concurrent.CompletableFuture declared in .Foo' type=java.util.concurrent.CompletableFuture origin=null + CALL 'public abstract fun value (): T of .Foo declared in .Foo' type=T of .Foo origin=null $this: GET_VAR ': .Foo.Foo> declared in .Foo.valueAsync' type=.Foo.Foo> origin=null FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:valueBlocking visibility:public modality:OPEN <> ($this:.Foo.Foo>) returnType:T of .Foo annotations: JvmAsync(baseName = , suffix = , asProperty = ) Api4J - JvmSynthetic $this: VALUE_PARAMETER name: type:.Foo.Foo> BLOCK_BODY RETURN type=kotlin.Nothing from='public open fun valueBlocking (): T of .Foo declared in .Foo' @@ -75,7 +74,7 @@ FILE fqName: fileName:/Main.kt FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:T of .Foo [suspend] BLOCK_BODY RETURN type=kotlin.Nothing from='local final fun (): T of .Foo declared in .Foo.valueBlocking' - CALL 'public open fun valueBlocking (): T of .Foo declared in .Foo' type=T of .Foo origin=null + CALL 'public abstract fun value (): T of .Foo declared in .Foo' type=T of .Foo origin=null $this: GET_VAR ': .Foo.Foo> declared in .Foo.valueBlocking' type=.Foo.Foo> origin=null FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] overridden: diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 6bd43cd..6be791c 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -2,10 +2,11 @@ kotlinx-coroutines = "1.8.0-RC2" kotlinx-serialization = "1.5.0" google-auto-service = "1.0.1" -kotlin = "1.9.21" +#kotlin = "2.0.0-Beta3" +kotlin = "1.9.22" compose = "1.5.4" compose-compiler = "1.5.6" -compose-plugin = "1.6.0-alpha01" +compose-plugin = "1.6.0-beta01" [libraries] diff --git a/runtime/suspend-transform-runtime/src/jvmMain/kotlin/love/forte/plugin/suspendtrans/runtime/RunInSuspendJvm.kt b/runtime/suspend-transform-runtime/src/jvmMain/kotlin/love/forte/plugin/suspendtrans/runtime/RunInSuspendJvm.kt index d344b6a..7678b12 100644 --- a/runtime/suspend-transform-runtime/src/jvmMain/kotlin/love/forte/plugin/suspendtrans/runtime/RunInSuspendJvm.kt +++ b/runtime/suspend-transform-runtime/src/jvmMain/kotlin/love/forte/plugin/suspendtrans/runtime/RunInSuspendJvm.kt @@ -19,7 +19,9 @@ private val `$CoroutineScope4J$`: CoroutineScope = CoroutineScope(`$CoroutineCon @Suppress("FunctionName") @Deprecated("Just for generate.", level = DeprecationLevel.HIDDEN) @Throws(InterruptedException::class) -public fun `$runInBlocking$`(block: suspend () -> T): T = runBlocking(`$CoroutineContext4J$`) { block() } +public fun `$runInBlocking$`(block: suspend () -> T): T = runBlocking(`$CoroutineContext4J$`) { + block() +} private val classLoader: ClassLoader @@ -75,9 +77,7 @@ private val transformer: FutureTransformer = public fun `$runInAsync$`( block: suspend () -> T, scope: CoroutineScope? = null -): CompletableFuture { - return transformer.trans(scope ?: `$CoroutineScope4J$`, block) -} +): CompletableFuture = transformer.trans(scope ?: `$CoroutineScope4J$`, block) diff --git a/samples/sample-jvm/build.gradle.kts b/samples/sample-jvm/build.gradle.kts index 4a4120c..948ce44 100644 --- a/samples/sample-jvm/build.gradle.kts +++ b/samples/sample-jvm/build.gradle.kts @@ -16,7 +16,7 @@ buildscript { } dependencies { //this.implementation() - classpath("love.forte.plugin.suspend-transform:suspend-transform-plugin-gradle:0.7.0-dev1") + classpath("love.forte.plugin.suspend-transform:suspend-transform-plugin-gradle:0.7.0-dev2") } } @@ -27,7 +27,11 @@ buildscript { //} tasks.withType { - kotlinOptions.freeCompilerArgs += "-Xjvm-default=all" + kotlinOptions { + freeCompilerArgs += "-Xjvm-default=all" + // useK2 + languageVersion = "2.0" + } } repositories { @@ -38,6 +42,8 @@ apply(plugin = "love.forte.plugin.suspend-transform") dependencies { api(kotlin("stdlib")) + api(kotlin("test-junit5")) + api(kotlin("reflect")) // val pluginVersion = "0.4.0" // api("love.forte.plugin.suspend-transform:suspend-transform-runtime:$pluginVersion") // api("love.forte.plugin.suspend-transform:suspend-transform-annotation:$pluginVersion") @@ -49,3 +55,7 @@ extensions.getByType().apply { println(this) this.useJvmDefault() } + +tasks.withType { + useJUnitPlatform() +} diff --git a/samples/sample-jvm/src/main/kotlin/love/forte/plugin/suspendtrans/sample/ForteScarlet.kt b/samples/sample-jvm/src/main/kotlin/love/forte/plugin/suspendtrans/sample/ForteScarlet.kt index 7f0bf66..a3ea367 100644 --- a/samples/sample-jvm/src/main/kotlin/love/forte/plugin/suspendtrans/sample/ForteScarlet.kt +++ b/samples/sample-jvm/src/main/kotlin/love/forte/plugin/suspendtrans/sample/ForteScarlet.kt @@ -1,17 +1,21 @@ package love.forte.plugin.suspendtrans.sample import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.delay import love.forte.plugin.suspendtrans.annotation.JvmAsync import love.forte.plugin.suspendtrans.annotation.JvmBlocking import kotlin.coroutines.CoroutineContext -import kotlin.coroutines.EmptyCoroutineContext abstract class IForteScarlet { @JvmAsync @JvmBlocking abstract suspend fun stringToInt(value: String): Int + + @JvmAsync(asProperty = true) + @JvmBlocking(asProperty = true) + abstract suspend fun value(): Int } @@ -20,8 +24,7 @@ abstract class IForteScarlet { * @author ForteScarlet */ class ForteScarlet : CoroutineScope, IForteScarlet() { - override val coroutineContext: CoroutineContext - get() = EmptyCoroutineContext + override val coroutineContext: CoroutineContext = Dispatchers.IO @JvmAsync @JvmBlocking @@ -30,6 +33,13 @@ class ForteScarlet : CoroutineScope, IForteScarlet() { return value.toInt() } + @JvmAsync(asProperty = true) + @JvmBlocking(asProperty = true) + override suspend fun value(): Int { + delay(1) + return 1 + } + // @JvmAsync // suspend fun stringToInt(value: String): Int { // delay(5) @@ -38,8 +48,14 @@ class ForteScarlet : CoroutineScope, IForteScarlet() { } -//fun main() { -// for (method in ForteScarlet::class.java.declaredMethods) { -// println(method) -// } -//} +fun main() { + for (method in ForteScarlet::class.java.declaredMethods) { + println(method) + } + +// println("b stringToInt: " + ForteScarlet().stringToIntBlocking("1")) +// println("a stringToInt: " + ForteScarlet().stringToIntAsync("1")) +// +// println("b value: " + ForteScarlet().valueBlocking) +// println("a value: " + ForteScarlet().valueAsync) +} diff --git a/samples/sample-jvm/src/test/kotlin/SuspendTransformTests.kt b/samples/sample-jvm/src/test/kotlin/SuspendTransformTests.kt new file mode 100644 index 0000000..93f9407 --- /dev/null +++ b/samples/sample-jvm/src/test/kotlin/SuspendTransformTests.kt @@ -0,0 +1,152 @@ +/* + * Copyright (c) 2024. ForteScarlet. + * + * Project https://github.com/simple-robot/simpler-robot + * Email ForteScarlet@163.com + * + * This file is part of the Simple Robot Library. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * Lesser GNU General Public License for more details. + * + * You should have received a copy of the Lesser GNU General Public License + * along with this program. If not, see . + * + */ +import love.forte.plugin.suspendtrans.annotation.JvmAsync +import love.forte.plugin.suspendtrans.annotation.JvmBlocking +import java.lang.reflect.Modifier +import java.util.concurrent.CompletableFuture +import kotlin.reflect.KTypeParameter +import kotlin.reflect.full.memberProperties +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertFalse +import kotlin.test.assertTrue + + +@JvmBlocking +@JvmAsync +interface STTrans1 { + suspend fun run1() + suspend fun run1(value: String): String +} + +@JvmBlocking(suffix = "", asProperty = true) +@JvmAsync(suffix = "Ay", asProperty = true) +interface STPTrans1 { + suspend fun run1(): Int + suspend fun run2(): String +} + +open class Foo +open class Bar : Foo() + +@JvmBlocking(asProperty = true) +@JvmAsync(asProperty = true) +interface ITypedTrans1 { + suspend fun value(): T +} + +@JvmBlocking(asProperty = true) +@JvmAsync(asProperty = true) +interface TypedTrans1Impl : ITypedTrans1 { + override suspend fun value(): T +} + +/** + * + * @author ForteScarlet + */ +class SuspendTransformTests { + + @Test + fun `interface suspend trans function test`() { + with(STTrans1::class.java) { + val blockingMethod = getMethod("run1Blocking") + val asyncMethod = getMethod("run1Async") + + assertEquals(Void.TYPE, blockingMethod.returnType) + assertEquals(CompletableFuture::class.java, asyncMethod.returnType) + + assertFalse(Modifier.isAbstract(blockingMethod.modifiers)) + assertFalse(Modifier.isAbstract(asyncMethod.modifiers)) + } + + with(STTrans1::class.java) { + val blockingMethod = getMethod("run1Blocking", String::class.java) + val asyncMethod = getMethod("run1Async", String::class.java) + + assertEquals(String::class.java, blockingMethod.returnType) + assertEquals(CompletableFuture::class.java, asyncMethod.returnType) + + assertFalse(Modifier.isAbstract(blockingMethod.modifiers)) + assertFalse(Modifier.isAbstract(asyncMethod.modifiers)) + } + } + + @Test + fun `interface suspend trans property test`() { + with(STPTrans1::class.memberProperties) { + assertTrue(any { it.name == "run1" && it.returnType.classifier == Int::class }) + assertTrue(any { it.name == "run2" && it.returnType.classifier == String::class }) + } + + // run1 + with(STPTrans1::class.java) { + val blockingPropertyMethod = getMethod("getRun1") + val asyncPropertyMethod = getMethod("getRun1Ay") + + assertEquals(Int::class.javaPrimitiveType, blockingPropertyMethod.returnType) + assertEquals(CompletableFuture::class.java, asyncPropertyMethod.returnType) + + assertFalse(Modifier.isAbstract(blockingPropertyMethod.modifiers)) + assertFalse(Modifier.isAbstract(asyncPropertyMethod.modifiers)) + } + + // run2 + with(STPTrans1::class.java) { + val blockingPropertyMethod = getMethod("getRun2") + val asyncPropertyMethod = getMethod("getRun2Ay") + + assertEquals(String::class.java, blockingPropertyMethod.returnType) + assertEquals(CompletableFuture::class.java, asyncPropertyMethod.returnType) + + assertFalse(Modifier.isAbstract(blockingPropertyMethod.modifiers)) + assertFalse(Modifier.isAbstract(asyncPropertyMethod.modifiers)) + } + + } + + + @Test + fun `typed interface test`() { + with(ITypedTrans1::class) { + assertTrue(memberProperties.any { + it.name == "valueBlocking" && with(it.returnType.classifier) { + this is KTypeParameter && this.upperBounds.any { b -> b.classifier == Foo::class } + } + }) + assertTrue(memberProperties.any { + it.name == "valueAsync" && it.returnType.classifier == CompletableFuture::class + }) + } + with(TypedTrans1Impl::class) { + assertTrue(memberProperties.any { + it.name == "valueBlocking" && with(it.returnType.classifier) { + this is KTypeParameter && this.upperBounds.any { b -> b.classifier == Bar::class } + } + }) + assertTrue(memberProperties.any { + it.name == "valueAsync" && it.returnType.classifier == CompletableFuture::class + }) + } + } +} diff --git a/samples/sample-wasmJs/build.gradle.kts b/samples/sample-wasmJs/build.gradle.kts index 116caf7..58dd964 100644 --- a/samples/sample-wasmJs/build.gradle.kts +++ b/samples/sample-wasmJs/build.gradle.kts @@ -54,7 +54,6 @@ kotlin { sourceSets { commonMain.dependencies { - val composev = "1.6.0-alpha01" // implementation("androidx.compose.ui:ui:$composev") // implementation("androidx.compose.ui:ui-tooling:$composev") // implementation("androidx.compose.ui:ui-tooling-preview:$composev") diff --git a/settings.gradle.kts b/settings.gradle.kts index 781ff8e..55c352e 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -30,4 +30,4 @@ include(":plugins:suspend-transform-plugin-gradle") //Samples include(":samples:sample-jvm") include(":samples:sample-js") -include(":samples:sample-wasmJs") +//include(":samples:sample-wasmJs") From 2e82f831ffa4c3b3ec44395f0aaed78c14d3e9a2 Mon Sep 17 00:00:00 2001 From: ForteScarlet Date: Fri, 26 Jan 2024 02:42:28 +0800 Subject: [PATCH 8/8] CI config --- .github/workflows/publish-release.yml | 24 +++++++++++++++++++++--- build.gradle.kts | 13 +++++++++++++ 2 files changed, 34 insertions(+), 3 deletions(-) diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml index 196064c..9e40575 100644 --- a/.github/workflows/publish-release.yml +++ b/.github/workflows/publish-release.yml @@ -21,7 +21,7 @@ env: jobs: test-build-publish: name: Test and build -# runs-on: ubuntu-latest + # runs-on: ubuntu-latest strategy: matrix: os: [ macos-latest, windows-latest, ubuntu-latest ] @@ -96,10 +96,28 @@ jobs: create-release: name: Create release runs-on: ubuntu-latest - needs: [test-build-publish, publish-gradle-plugin] + needs: [ test-build-publish, publish-gradle-plugin ] permissions: contents: write steps: + # 检出仓库代码 + - name: Check out repo + uses: actions/checkout@v3 + + # Setup java + # https://github.com/marketplace/actions/setup-java-jdk + - name: Setup Java + uses: actions/setup-java@v3 + with: + distribution: 'zulu' + java-version: 11 + + - name: Create changelog + uses: gradle/gradle-build-action@v2 + with: + gradle-version: 8.5 + arguments: createChangelog + # https://github.com/softprops/action-gh-release # Create gitHub release - name: Create Github Release @@ -107,6 +125,6 @@ jobs: with: token: ${{ secrets.FORTE_TOKEN }} draft: true -# body_path: .changelog/${{ github.ref_name }}.md + body_path: .changelog/${{ github.ref_name }}.md generate_release_notes: true prerelease: ${{ contains(github.ref_name, 'preview') || contains(github.ref_name, 'beta') || contains(github.ref_name, 'alpha') }} diff --git a/build.gradle.kts b/build.gradle.kts index e62d10d..7f02541 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -30,3 +30,16 @@ allprojects { apply(plugin = "suspend-transform.nexus-publish") +tasks.create("createChangelog") { + group = "documentation" + doFirst { + val tag = "v${IProject.version}" + val changelogDir = rootProject.file(".changelog").apply { mkdirs() } + with(File(changelogDir, "$tag.md")) { + if (!exists()) { + createNewFile() + } + writeText("Kotlin version: `v${libs.versions.kotlin.get()}`") + } + } +}