From e0d727ed4ba41858a29800291bf9ebd86a32c134 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adriel=20Caf=C3=A9?= Date: Sun, 20 Feb 2022 21:16:49 -0300 Subject: [PATCH] refactor: replace inline fun to avoid reflection --- .../cafe/adriel/voyager/core/registry/ScreenRegistry.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/voyager-core/src/commonMain/kotlin/cafe/adriel/voyager/core/registry/ScreenRegistry.kt b/voyager-core/src/commonMain/kotlin/cafe/adriel/voyager/core/registry/ScreenRegistry.kt index af99690e..b8738219 100644 --- a/voyager-core/src/commonMain/kotlin/cafe/adriel/voyager/core/registry/ScreenRegistry.kt +++ b/voyager-core/src/commonMain/kotlin/cafe/adriel/voyager/core/registry/ScreenRegistry.kt @@ -21,8 +21,9 @@ public object ScreenRegistry { factories[T::class] = factory as ScreenFactory } - public inline fun get(provider: T): Screen { - val factory = factories[T::class] ?: error("ScreenProvider not registered: ${T::class.qualifiedName}") + public fun get(provider: ScreenProvider): Screen { + val factory = factories[provider::class] + ?: error("ScreenProvider not registered: ${provider::class.qualifiedName}") return factory(provider) } }