[K/JS] Implement file merging for clashed file during per-file compilation

This commit is contained in:
Artem Kobzar
2023-09-14 13:14:15 +00:00
committed by Space Team
parent 337054ba92
commit 878452bd2b
43 changed files with 529 additions and 277 deletions
@@ -75,3 +75,8 @@ fun <T> Collection<T>.atMostOne(): T? {
* If there are more such elements, throws an exception.
*/
inline fun <T> Iterable<T>.atMostOne(predicate: (T) -> Boolean): T? = this.filter(predicate).atMostOne()
fun <K, V> MutableMap<K, MutableList<V>>.putToMultiMap(key: K, value: V) {
val list = getOrPut(key) { mutableListOf() }
list.add(value)
}