Skip to content

Commit 318c37e

Browse files
committed
feat: make @scope repeatable to configure scopes
1 parent 286a536 commit 318c37e

File tree

11 files changed

+161
-45
lines changed

11 files changed

+161
-45
lines changed

examples/coffee-maker-glob/src/test/java/CoffeeGlobAppTest.kt

+26-2
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ import org.koin.example.test.scope.*
2424
import org.koin.ksp.generated.module
2525
import org.koin.mp.KoinPlatformTools
2626
import kotlin.test.assertFalse
27+
import kotlin.test.assertNotNull
28+
import kotlin.test.assertNull
2729
import kotlin.test.assertTrue
2830
import kotlin.time.measureTime
2931

@@ -73,10 +75,32 @@ class CoffeeGlobAppTest {
7375
assert(scopeS.get<MyScopedComponent3>() != scopeS.get<MyScopedComponent3>())
7476
assert(myScope == scopeS.get<MyScopedComponent4>().myScope)
7577

78+
assert(myScope == scopeS.get<MyScopedComponentMultiScope>().myScope.value)
79+
assert(myScope == scopeS.get<MyScopedComponentMultiScope2>().myScope.value)
80+
assert(myScope == scopeS.get<MyScopedComponentMultiScope3>().myScope.value)
81+
assert(scopeS.get<MyScopedComponentMultiScope3>() != scopeS.get<MyScopedComponentMultiScope3>())
82+
assert(myScope == scopeS.get<MyScopedComponentMultiScope4>().myScope.value)
83+
7684
assert(scopeS.getOrNull<AdditionalTypeScope2>() != null)
85+
assert(scopeS.getOrNull<AdditionalTypeMultiScope2>() != null)
86+
87+
val myScopeSession = koin.createScope("_ID2_", named(MY_SCOPE_SESSION))
88+
assertNotNull(myScopeSession.get<MyScopedSessionComponent>())
89+
assertNotNull(myScopeSession.get<MyScopedSessionComponentMultiScope>())
90+
91+
val myAnotherScope = MyAnotherScope()
92+
val anotherScopeS = koin.createScope("_ID3_", named<MyScope>(), myAnotherScope)
93+
assert(myAnotherScope == anotherScopeS.get<MyScopedComponentMultiScope>().myAnotherScope.value)
94+
assert(myAnotherScope == anotherScopeS.get<MyScopedComponentMultiScope2>().myAnotherScope.value)
95+
assert(myAnotherScope == anotherScopeS.get<MyScopedComponentMultiScope3>().myAnotherScope.value)
96+
assert(anotherScopeS.get<MyScopedComponentMultiScope3>() != anotherScopeS.get<MyScopedComponentMultiScope3>())
97+
assert(myAnotherScope == anotherScopeS.get<MyScopedComponentMultiScope4>().myAnotherScope.value)
98+
99+
assert(anotherScopeS.getOrNull<AdditionalTypeMultiScope2>() != null)
77100

78-
koin.createScope("_ID2_", named(MY_SCOPE_SESSION))
79-
.get<MyScopedSessionComponent>()
101+
val myScopeSession2 = koin.createScope("_ID4_", named(MY_SCOPE_SESSION2))
102+
assertNull(myScopeSession2.getOrNull<MyScopedSessionComponent>())
103+
assertNotNull(myScopeSession2.get<MyScopedSessionComponentMultiScope>())
80104

81105
assert(koin.get<TestComponentConsumer3>{ parametersOf(null) }.id == null)
82106
assert(koin.get<TestComponentConsumer3> { parametersOf("42") }.id == "42")

examples/coffee-maker-module/src/main/kotlin/org/koin/example/test/scope/ScopeModule.kt

+34
Original file line numberDiff line numberDiff line change
@@ -3,37 +3,71 @@ package org.koin.example.test.scope
33
import org.koin.core.annotation.*
44

55
class MyScope
6+
class MyAnotherScope
67
interface AdditionalTypeScope
78
interface AdditionalTypeScope2
9+
interface AdditionalTypeMultiScope
10+
interface AdditionalTypeMultiScope2
811

912
const val MY_SCOPE_SESSION = "MY_SCOPE_SESSION"
13+
const val MY_SCOPE_SESSION2 = "MY_SCOPE_SESSION2"
1014

1115
@Scope(MyScope::class)
1216
class MyScopedComponent(val myScope: MyScope)
17+
@Scope(MyScope::class)
18+
@Scope(MyAnotherScope::class)
19+
class MyScopedComponentMultiScope(@Provided val myScope: Lazy<MyScope>, @Provided val myAnotherScope: Lazy<MyAnotherScope>)
1320

1421
class MyScopedComponent2(val myScope: MyScope)
1522

23+
class MyScopedComponentMultiScope2(val myScope: Lazy<MyScope>, val myAnotherScope: Lazy<MyAnotherScope>)
24+
1625
@Scope(MyScope::class)
1726
@Factory
1827
class MyScopedComponent3(val myScope: MyScope) : AdditionalTypeScope
1928

29+
@Scope(MyScope::class)
30+
@Scope(MyAnotherScope::class)
31+
@Factory
32+
class MyScopedComponentMultiScope3(@Provided val myScope: Lazy<MyScope>, @Provided val myAnotherScope: Lazy<MyAnotherScope>) : AdditionalTypeMultiScope
33+
2034
@Scope(MyScope::class)
2135
@Scoped(binds = [AdditionalTypeScope2::class])
2236
class MyScopedComponent5(val myScope: MyScope) : AdditionalTypeScope, AdditionalTypeScope2
2337

38+
@Scope(MyScope::class)
39+
@Scope(MyAnotherScope::class)
40+
@Scoped(binds = [AdditionalTypeMultiScope2::class])
41+
class MyScopedComponentMultiScope5 : AdditionalTypeMultiScope, AdditionalTypeMultiScope2
42+
2443
class MyScopedComponent4(val myScope: MyScope)
2544

45+
class MyScopedComponentMultiScope4(val myScope: Lazy<MyScope>, val myAnotherScope: Lazy<MyAnotherScope>)
46+
2647
@Scope(name = MY_SCOPE_SESSION)
2748
class MyScopedSessionComponent
2849

50+
@Scope(name = MY_SCOPE_SESSION)
51+
@Scope(name = MY_SCOPE_SESSION2)
52+
class MyScopedSessionComponentMultiScope
53+
2954
@Module
3055
@ComponentScan
3156
class ScopeModule {
3257

3358
@Scope(MyScope::class)
3459
fun myScopedComponent2(myScope: MyScope) = MyScopedComponent2(myScope)
3560

61+
@Scope(MyScope::class)
62+
@Scope(MyAnotherScope::class)
63+
fun myScopedComponentMultiScope2(@Provided myScope: Lazy<MyScope>, @Provided myAnotherScope: Lazy<MyAnotherScope>) = MyScopedComponentMultiScope2(myScope, myAnotherScope)
64+
3665
@Scope(MyScope::class)
3766
@Factory
3867
fun myScopedComponent4(myScope: MyScope) = MyScopedComponent4(myScope)
68+
69+
@Scope(MyScope::class)
70+
@Scope(MyAnotherScope::class)
71+
@Factory
72+
fun myScopedComponentMultiScope4(@Provided myScope: Lazy<MyScope>, @Provided myAnotherScope: Lazy<MyAnotherScope>) = MyScopedComponentMultiScope4(myScope, myAnotherScope)
3973
}

examples/coffee-maker/src/test/java/CoffeeAppTest.kt

+43-2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import org.koin.example.test.include.IncludedComponent
2121
import org.koin.example.test.scope.*
2222
import org.koin.ksp.generated.module
2323
import org.koin.mp.KoinPlatformTools
24+
import kotlin.test.*
2425
import kotlin.time.measureTime
2526

2627
class CoffeeAppTest {
@@ -72,8 +73,48 @@ class CoffeeAppTest {
7273

7374
assert(scopeS.getOrNull<AdditionalTypeScope2>() != null)
7475

75-
koin.createScope("_ID2_", named(MY_SCOPE_SESSION))
76-
.get<MyScopedSessionComponent>()
76+
val myScopeSession = koin.createScope("_ID2_", named(MY_SCOPE_SESSION))
77+
assertNotNull(myScopeSession.getOrNull<MyScopedSessionComponent>())
78+
79+
// BEGIN MUltiScope
80+
val myAnotherScope = MyAnotherScope()
81+
val anotherScopeS = koin.createScope("_ID3_", named<MyAnotherScope>(), myAnotherScope)
82+
assertEquals(myScope, scopeS.get<MyScopedComponentMultiScope>().myScope.value)
83+
assertFails { scopeS.get<MyScopedComponentMultiScope>().myAnotherScope.value }
84+
assertEquals(myAnotherScope, anotherScopeS.get<MyScopedComponentMultiScope>().myAnotherScope.value)
85+
assertFails { anotherScopeS.get<MyScopedComponentMultiScope>().myScope.value }
86+
87+
assertEquals(myScope, scopeS.get<MyScopedComponentMultiScope2>().myScope.value)
88+
assertFails { scopeS.get<MyScopedComponentMultiScope2>().myAnotherScope.value }
89+
assertEquals(myAnotherScope, anotherScopeS.get<MyScopedComponentMultiScope2>().myAnotherScope.value)
90+
assertFails { anotherScopeS.get<MyScopedComponentMultiScope2>().myScope.value }
91+
92+
assertEquals(myScope, scopeS.get<MyScopedComponentMultiScope3>().myScope.value)
93+
assertFails { scopeS.get<MyScopedComponentMultiScope3>().myAnotherScope.value }
94+
assertEquals(myAnotherScope, anotherScopeS.get<MyScopedComponentMultiScope3>().myAnotherScope.value)
95+
assertFails { anotherScopeS.get<MyScopedComponentMultiScope3>().myScope.value }
96+
assertNotEquals(scopeS.get<MyScopedComponentMultiScope3>(), scopeS.get<MyScopedComponentMultiScope3>())
97+
assertNotEquals(anotherScopeS.get<MyScopedComponentMultiScope3>(), anotherScopeS.get<MyScopedComponentMultiScope3>())
98+
99+
assertEquals(myScope, scopeS.get<MyScopedComponentMultiScope4>().myScope.value)
100+
assertFails { scopeS.get<MyScopedComponentMultiScope4>().myAnotherScope.value }
101+
assertEquals(myAnotherScope, anotherScopeS.get<MyScopedComponentMultiScope4>().myAnotherScope.value)
102+
assertFails { anotherScopeS.get<MyScopedComponentMultiScope4>().myScope.value }
103+
assertNotEquals(scopeS.get<MyScopedComponentMultiScope4>(), scopeS.get<MyScopedComponentMultiScope4>())
104+
assertNotEquals(anotherScopeS.get<MyScopedComponentMultiScope4>(), anotherScopeS.get<MyScopedComponentMultiScope4>())
105+
106+
assertNotNull(scopeS.getOrNull<AdditionalTypeMultiScope>())
107+
assertNotNull(anotherScopeS.getOrNull<AdditionalTypeMultiScope>())
108+
109+
assertNotNull(scopeS.getOrNull<AdditionalTypeMultiScope2>())
110+
assertSame(scopeS.getOrNull<AdditionalTypeMultiScope2>(), scopeS.getOrNull<MyScopedComponentMultiScope5>())
111+
assertNotNull(anotherScopeS.getOrNull<AdditionalTypeMultiScope2>())
112+
assertSame(anotherScopeS.getOrNull<AdditionalTypeMultiScope2>(), anotherScopeS.getOrNull<MyScopedComponentMultiScope5>())
113+
114+
assertNotNull(myScopeSession.getOrNull<MyScopedSessionComponentMultiScope>())
115+
val myScopeSession2 = koin.createScope("_ID4_", named(MY_SCOPE_SESSION2))
116+
assertNotNull(myScopeSession2.getOrNull<MyScopedSessionComponentMultiScope>())
117+
// END MUltiScope
77118

78119
assert(koin.get<TestComponentConsumer3>{ parametersOf(null) }.id == null)
79120
assert(koin.get<TestComponentConsumer3>{ parametersOf("42") }.id == "42")

projects/koin-annotations/src/commonMain/kotlin/org/koin/core/annotation/CoreAnnotations.kt

+5
Original file line numberDiff line numberDiff line change
@@ -74,18 +74,23 @@ annotation class Factory(val binds: Array<KClass<*>> = [Unit::class])
7474
* example:
7575
*
7676
* @Scope(MyScope::class)
77+
* @Scope(MyAnotherScope::class)
7778
* class MyClass(val d : MyDependency)
7879
*
7980
* will generate:
8081
* ```
8182
* scope<MyScope> {
8283
* scoped { MyClass(get()) }
8384
* }
85+
* scope<MyAnotherScope> {
86+
* scoped { MyClass(get()) }
87+
* }
8488
* ```
8589
*
8690
* @param value: scope class value
8791
* @param name: scope string value
8892
*/
93+
@Repeatable
8994
@Target(AnnotationTarget.CLASS, AnnotationTarget.FUNCTION)
9095
annotation class Scope(val value: KClass<*> = Unit::class, val name: String = "")
9196

projects/koin-ksp-compiler/src/jvmMain/kotlin/org/koin/compiler/metadata/AnnotationMetadata.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ fun isValidAnnotation(s: String): Boolean = s.lowercase(Locale.getDefault()) in
5555
fun isValidScopeExtraAnnotation(s: String): Boolean = s.lowercase(Locale.getDefault()) in SCOPE_DEFINITION_ANNOTATION_LIST_NAMES
5656
fun isScopeAnnotation(s: String): Boolean = s.lowercase(Locale.getDefault()) == SCOPE.annotationName?.lowercase(Locale.getDefault())
5757

58-
fun getExtraScopeAnnotation(annotations: Map<String, KSAnnotation>): DefinitionAnnotation? {
58+
fun getExtraScopeAnnotation(annotations: Map<String, List<KSAnnotation>>): DefinitionAnnotation? {
5959
val key = annotations.keys.firstOrNull { k -> isValidScopeExtraAnnotation(k) }
6060
val definitionAnnotation = when (key) {
6161
SCOPED.annotationName -> SCOPED

projects/koin-ksp-compiler/src/jvmMain/kotlin/org/koin/compiler/scanner/ClassComponentScanner.kt

+13-9
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,23 @@ class ClassComponentScanner(
2424
val logger: KSPLogger,
2525
) {
2626

27-
fun createClassDefinition(element: KSAnnotated): KoinMetaData.Definition {
27+
fun createClassDefinition(element: KSAnnotated): List<KoinMetaData.Definition> {
2828
val ksClassDeclaration = (element as KSClassDeclaration)
2929
val packageName = ksClassDeclaration.getPackageName().filterForbiddenKeywords()
3030
val className = ksClassDeclaration.simpleName.asString()
3131
val qualifier = ksClassDeclaration.getQualifier()
3232
val annotations = element.getKoinAnnotations()
33-
val scopeAnnotation = annotations.getScopeAnnotation()
34-
return if (scopeAnnotation != null){
35-
createClassDefinition(element, scopeAnnotation.second, ksClassDeclaration, scopeAnnotation.first, packageName, qualifier, className, annotations)
36-
} else {
37-
annotations.firstNotNullOf { (annotationName, annotation) ->
38-
createClassDefinition(element, annotation, ksClassDeclaration, annotationName, packageName, qualifier, className, annotations)
33+
val scopeAnnotations = annotations.getScopeAnnotations()
34+
return if (scopeAnnotations != null) {
35+
scopeAnnotations.second.map {
36+
createClassDefinition(element, it, ksClassDeclaration, scopeAnnotations.first, packageName, qualifier, className, annotations)
3937
}
38+
} else {
39+
listOf(
40+
annotations.firstNotNullOf { (annotationName, annotation) ->
41+
createClassDefinition(element, annotation.single(), ksClassDeclaration, annotationName, packageName, qualifier, className, annotations)
42+
}
43+
)
4044
}
4145
}
4246

@@ -48,7 +52,7 @@ class ClassComponentScanner(
4852
packageName: String,
4953
qualifier: String?,
5054
className: String,
51-
annotations: Map<String, KSAnnotation> = emptyMap()
55+
annotations: Map<String, List<KSAnnotation>> = emptyMap()
5256
): KoinMetaData.Definition.ClassDefinition {
5357
val declaredBindings = declaredBindings(annotation)
5458
val defaultBindings = ksClassDeclaration.superTypes.map { it.resolve().declaration }.toList()
@@ -77,7 +81,7 @@ class ClassComponentScanner(
7781
SCOPE.annotationName -> {
7882
val scopeData : KoinMetaData.Scope = annotation.arguments.getScope()
7983
val extraAnnotationDefinition = getExtraScopeAnnotation(annotations)
80-
val extraAnnotation = annotations[extraAnnotationDefinition?.annotationName]
84+
val extraAnnotation = annotations[extraAnnotationDefinition?.annotationName]?.single()
8185
val extraDeclaredBindings = extraAnnotation?.let { declaredBindings(it) }
8286
val extraScopeBindings = if(extraDeclaredBindings?.hasDefaultUnitValue() == false) extraDeclaredBindings else allBindings
8387
createClassDefinition(extraAnnotationDefinition ?: SCOPE,packageName, qualifier, className, ctorParams, extraScopeBindings,scope = scopeData, isExpect = isExpect, isActual = isActual)

projects/koin-ksp-compiler/src/jvmMain/kotlin/org/koin/compiler/scanner/FunctionComponentScanner.kt

+18-12
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,24 @@
1616
package org.koin.compiler.scanner
1717

1818
import com.google.devtools.ksp.processing.KSPLogger
19-
import com.google.devtools.ksp.symbol.*
20-
import org.koin.compiler.metadata.*
19+
import com.google.devtools.ksp.symbol.KSAnnotated
20+
import com.google.devtools.ksp.symbol.KSClassDeclaration
21+
import com.google.devtools.ksp.symbol.KSFunctionDeclaration
22+
import org.koin.compiler.metadata.KoinMetaData
2123
import org.koin.compiler.scanner.ext.filterForbiddenKeywords
2224
import org.koin.compiler.scanner.ext.getKoinAnnotations
2325
import org.koin.compiler.scanner.ext.getQualifier
24-
import org.koin.compiler.scanner.ext.getScopeAnnotation
26+
import org.koin.compiler.scanner.ext.getScopeAnnotations
2527

2628
class FunctionComponentScanner(
2729
val logger: KSPLogger
2830
) : FunctionScanner(isModuleFunction = false) {
2931

30-
fun createFunctionDefinition(element: KSAnnotated): KoinMetaData.Definition? {
31-
return addFunctionDefinition(element)
32+
fun createFunctionDefinitions(element: KSAnnotated): List<KoinMetaData.Definition>? {
33+
return addFunctionDefinitions(element)
3234
}
3335

34-
private fun addFunctionDefinition(element: KSAnnotated): KoinMetaData.Definition? {
36+
private fun addFunctionDefinitions(element: KSAnnotated): List<KoinMetaData.Definition>? {
3537
val ksFunctionDeclaration = (element as KSFunctionDeclaration)
3638
val packageName = ksFunctionDeclaration.packageName.asString().filterForbiddenKeywords()
3739
val returnedType = ksFunctionDeclaration.returnType?.resolve()?.declaration?.simpleName?.toString()
@@ -45,14 +47,18 @@ class FunctionComponentScanner(
4547
}
4648

4749
val annotations = element.getKoinAnnotations()
48-
val scopeAnnotation = annotations.getScopeAnnotation()
50+
val scopeAnnotations = annotations.getScopeAnnotations()
4951

50-
val definition = if (scopeAnnotation != null){
51-
declareDefinition(scopeAnnotation.first, scopeAnnotation.second, packageName, qualifier, functionName, ksFunctionDeclaration, annotations)
52-
} else {
53-
annotations.firstNotNullOf { (annotationName, annotation) ->
54-
declareDefinition(annotationName, annotation, packageName, qualifier, functionName, ksFunctionDeclaration, annotations)
52+
val definition = if (scopeAnnotations != null) {
53+
scopeAnnotations.second.mapNotNull {
54+
declareDefinition(scopeAnnotations.first, it, packageName, qualifier, functionName, ksFunctionDeclaration, annotations)
5555
}
56+
} else {
57+
listOf(
58+
annotations.firstNotNullOf { (annotationName, annotation) ->
59+
declareDefinition(annotationName, annotation.single(), packageName, qualifier, functionName, ksFunctionDeclaration, annotations)
60+
}
61+
)
5662
}
5763
definition
5864
}

projects/koin-ksp-compiler/src/jvmMain/kotlin/org/koin/compiler/scanner/FunctionScanner.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ abstract class FunctionScanner(
3838
qualifier: String?,
3939
functionName: String,
4040
ksFunctionDeclaration: KSFunctionDeclaration,
41-
annotations: Map<String, KSAnnotation> = emptyMap()
41+
annotations: Map<String, List<KSAnnotation>> = emptyMap()
4242
): KoinMetaData.Definition.FunctionDefinition? {
4343
val foundBindings: List<KSDeclaration> = declaredBindings(annotation)?.let { if (!it.hasDefaultUnitValue()) it else emptyList() } ?: emptyList()
4444
val returnedType: KSDeclaration? = ksFunctionDeclaration.returnType?.resolve()?.declaration

projects/koin-ksp-compiler/src/jvmMain/kotlin/org/koin/compiler/scanner/KoinMetaDataScanner.kt

+3-4
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,8 @@ class KoinMetaDataScanner(
154154

155155
val definitions = resolver.getValidDefinitionSymbols()
156156
.filterIsInstance<KSFunctionDeclaration>()
157-
.mapNotNull { functionMetadataScanner.createFunctionDefinition(it) }
158-
.toList()
157+
.mapNotNull { functionMetadataScanner.createFunctionDefinitions(it) }
158+
.flatten()
159159

160160
definitions.forEach { addToModule(it, defaultModule, scanComponentIndex) }
161161
return definitions
@@ -170,8 +170,7 @@ class KoinMetaDataScanner(
170170

171171
val definitions = resolver.getValidDefinitionSymbols()
172172
.filterIsInstance<KSClassDeclaration>()
173-
.map { componentMetadataScanner.createClassDefinition(it) }
174-
.toList()
173+
.flatMap { componentMetadataScanner.createClassDefinition(it) }
175174
definitions.forEach { addToModule(it, defaultModule, scanComponentIndex) }
176175
return definitions
177176
}

projects/koin-ksp-compiler/src/jvmMain/kotlin/org/koin/compiler/scanner/ModuleScanner.kt

+12-8
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ class ModuleScanner(
6060
}
6161
.toList()
6262

63-
val definitions = annotatedFunctions.mapNotNull { addFunctionDefinition(it) }
63+
val definitions = annotatedFunctions.mapNotNull { addFunctionDefinitions(it) }.flatten()
6464
moduleMetadata.definitions += definitions
6565

6666
return moduleMetadata
@@ -81,7 +81,7 @@ class ModuleScanner(
8181
return componentScan?.let(::componentsScanValue)?.toSet() ?: emptySet()
8282
}
8383

84-
private fun addFunctionDefinition(element: KSAnnotated): KoinMetaData.Definition? {
84+
private fun addFunctionDefinitions(element: KSAnnotated): List<KoinMetaData.Definition>? {
8585
val ksFunctionDeclaration = (element as KSFunctionDeclaration)
8686
val packageName = ksFunctionDeclaration.packageName.asString().filterForbiddenKeywords()
8787
val returnedType = ksFunctionDeclaration.returnType?.resolve()?.declaration?.simpleName?.toString()
@@ -90,14 +90,18 @@ class ModuleScanner(
9090
return returnedType?.let {
9191
val functionName = ksFunctionDeclaration.simpleName.asString()
9292
val annotations = element.getKoinAnnotations()
93-
val scopeAnnotation = annotations.getScopeAnnotation()
93+
val scopeAnnotations = annotations.getScopeAnnotations()
9494

95-
return if (scopeAnnotation != null){
96-
declareDefinition(scopeAnnotation.first, scopeAnnotation.second, packageName, qualifier, functionName, ksFunctionDeclaration, annotations)
97-
} else {
98-
annotations.firstNotNullOf { (annotationName, annotation) ->
99-
declareDefinition(annotationName, annotation, packageName, qualifier, functionName, ksFunctionDeclaration, annotations)
95+
return if (scopeAnnotations != null) {
96+
scopeAnnotations.second.mapNotNull {
97+
declareDefinition(scopeAnnotations.first, it, packageName, qualifier, functionName, ksFunctionDeclaration, annotations)
10098
}
99+
} else {
100+
listOf(
101+
annotations.firstNotNullOf { (annotationName, annotation) ->
102+
declareDefinition(annotationName, annotation.single(), packageName, qualifier, functionName, ksFunctionDeclaration, annotations)
103+
}
104+
)
101105
}
102106
}
103107
}

0 commit comments

Comments
 (0)