Skip to content
This repository was archived by the owner on Jan 20, 2023. It is now read-only.

Commit 0ad6072

Browse files
committed
初期化状態も見るよう修正
1 parent 35adad0 commit 0ad6072

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/main/kotlin/com/mapk/fastkfunction/argumentbucket/ArgumentBucket.kt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,12 @@ class ArgumentBucket(
6565
override val values: Collection<Any?>
6666
get() = valueArray.filterIndexed { idx, _ -> initializationStatuses[idx] }
6767

68-
// keyはインスタンスの一致を見る
69-
override fun containsKey(key: KParameter): Boolean = keyList[key.index] === key
68+
// keyはインスタンスの一致と初期化状態を見る
69+
override fun containsKey(key: KParameter): Boolean =
70+
keyList[key.index] === key && initializationStatuses[key.index]
7071

71-
override fun containsValue(value: Any?): Boolean = valueArray.any { it == value }
72+
override fun containsValue(value: Any?): Boolean = valueArray.withIndex()
73+
.any { initializationStatuses[it.index] && it.value == value }
7274

7375
override fun get(key: KParameter): Any? = valueArray[key.index]
7476

0 commit comments

Comments
 (0)