You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: compiler/suspend-transform-plugin-configuration/src/main/kotlin/love/forte/plugin/suspendtrans/configuration/SuspendTransformConfiguration.kt
+30-16Lines changed: 30 additions & 16 deletions
Original file line number
Diff line number
Diff line change
@@ -227,71 +227,85 @@ class IncludeAnnotation @InternalSuspendTransformConfigurationApi constructor(
* Among them, this asynchronous function can have a second parameter, which must be of type [kotlinx.coroutines.CoroutineScope] and is recommended to be nullable.
246
+
* If this parameter exists, when the type containing the transform function implements [kotlinx.coroutines.CoroutineScope] itself, it will fill in itself as a parameter, similar to:
247
247
*
248
248
* ```kotlin
249
249
* class Bar : CoroutineScope {
250
-
* @Xxx
250
+
* @Xxx // your custom transform function's mark annotation
* If the scope parameter is nullable, then the effect is similar to:
258
+
*
259
+
* ```kotlin
260
+
* class Bar {
261
+
* @Xxx // your custom transform function's mark annotation
262
+
* suspend fun foo(): Foo
263
+
*
264
+
* @Api4J fun fooXxx(): CompletableFuture<Foo> = transform(block = { foo() }, scope = this as? CoroutineScope)
265
+
* }
266
+
* ```
267
+
* Therefore, when nullable it is more inheritance-friendly - when the subclass extends CoroutineScope the parameter can take effect, regardless of whether it overrides this function.
268
+
*
255
269
*/
256
270
valtransformFunctionInfo:FunctionInfo,
257
271
258
272
/**
259
-
* 转化后的返回值类型, 为null时代表与原函数一致。
273
+
* The return type after transformation. When null, it represents the same as the original function.
260
274
*/
261
275
valtransformReturnType:ClassInfo?,
262
276
263
277
// TODO TypeGeneric for suspend function return type and transform function return type?
264
278
265
279
/**
266
-
* 转化后的返回值类型中,是否存在需要与原本返回值类型一致的泛型。
280
+
* Whether there are generics in the transformed return type that need to be consistent with the original return type.
267
281
*/
268
282
valtransformReturnTypeGeneric:Boolean,
269
283
270
284
/**
271
-
* 函数生成后,需要在原函数上追加的注解信息。
285
+
* Annotation information that needs to be added to the original function after function generation.
272
286
*
273
-
* 例如追加个 `@kotlin.jvm.JvmSynthetic` 之类的。
287
+
* For example, add something like `@kotlin.jvm.JvmSynthetic`.
0 commit comments