aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/moe/nea/firmament/commands
diff options
context:
space:
mode:
authorWalker Selby <git@walkerselby.com>2023-10-26 16:49:09 +0100
committernea <nea@nea.moe>2023-10-26 19:47:04 +0200
commit710d9ec3f720cee115168f3d9de01fa4ab3bdff8 (patch)
treebcf19a2e8d2ae53bd4204648477287aef7332ed8 /src/main/kotlin/moe/nea/firmament/commands
parentfb59b2afed3cbef01a87d305768fdd7d0420df82 (diff)
downloadFirmament-710d9ec3f720cee115168f3d9de01fa4ab3bdff8.tar.gz
Firmament-710d9ec3f720cee115168f3d9de01fa4ab3bdff8.tar.bz2
Firmament-710d9ec3f720cee115168f3d9de01fa4ab3bdff8.zip
Refactor if to when in dsl.kt
[no changelog]
Diffstat (limited to 'src/main/kotlin/moe/nea/firmament/commands')
-rw-r--r--src/main/kotlin/moe/nea/firmament/commands/dsl.kt13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/main/kotlin/moe/nea/firmament/commands/dsl.kt b/src/main/kotlin/moe/nea/firmament/commands/dsl.kt
index 60756f4..53a3622 100644
--- a/src/main/kotlin/moe/nea/firmament/commands/dsl.kt
+++ b/src/main/kotlin/moe/nea/firmament/commands/dsl.kt
@@ -37,14 +37,11 @@ fun literal(
private fun normalizeGeneric(argument: Type): Class<*> {
- return if (argument is Class<*>) {
- argument
- } else if (argument is TypeVariable<*>) {
- normalizeGeneric(argument.bounds[0])
- } else if (argument is ParameterizedType) {
- normalizeGeneric(argument.rawType)
- } else {
- Any::class.java
+ return when (argument) {
+ is Class<*> -> argument
+ is TypeVariable<*> -> normalizeGeneric(argument.bounds[0])
+ is ParameterizedType -> normalizeGeneric(argument.rawType)
+ else -> Any::class.java
}
}