Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Breaking looping linked scopes when first got instance. #775

Merged
merged 3 commits into from
May 27, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ _Core_
* `[FIXED]` - declare to use reified type
* `[FIXED]` - Qualifier type as pure string
* `[FIXED]` - docs contribution
* `[UPDATED]` - Kotlin 1.3.71


_Ktor_
Expand Down
2 changes: 1 addition & 1 deletion koin-projects/gradle/versions.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ ext {
koin_version = '2.1.5'

// Kotlin
kotlin_version = '1.3.70'
kotlin_version = '1.3.71'
coroutines_version = "1.3.3"

// Dokka
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,17 +226,16 @@ data class Scope(
qualifier: Qualifier?,
parameters: ParametersDefinition?
): T? {
return _linkedScope.firstOrNull { scope ->
scope.getOrNull<T>(
clazz,
qualifier,
parameters
) != null
}?.get(
clazz,
qualifier,
parameters
)
var instance: T? = null
for (scope in _linkedScope) {
instance = scope.getOrNull<T>(
clazz,
qualifier,
parameters
)
if (instance != null) break
}
return instance
}

private fun throwDefinitionNotFound(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,5 @@ fun Application.koin(configuration: KoinAppDeclaration) = featureOrNull(Koin)?.a
*
* Gets or installs a [Koin] feature for the this [Application] and install a [block] modules on it
*/
@KoinExperimentalAPI
@ContextDsl
fun Application.modules(vararg block: Module) = koin { modules(block.asList()) }