Fix select.kt
This commit is contained in:
parent
e5000171f1
commit
6b41163ed3
@ -35,10 +35,12 @@ private fun <R : Any> Data<*>.castOrNull(type: KType): Data<R>? =
|
||||
public fun <R : Any> DataSet<*>.select(
|
||||
type: KType,
|
||||
namePattern: Name? = null,
|
||||
filter: (name: Name, meta: Meta) -> Boolean = { _, _ -> true }
|
||||
filter: (name: Name, meta: Meta) -> Boolean = { _, _ -> true },
|
||||
): ActiveDataSet<R> = object : ActiveDataSet<R> {
|
||||
override val dataType = type
|
||||
|
||||
override val meta: Meta get() = this@select.meta
|
||||
|
||||
private fun checkDatum(name: Name, datum: Data<*>): Boolean = datum.type.isSubtypeOf(type)
|
||||
&& (namePattern == null || name.matches(namePattern))
|
||||
&& filter(name, datum.meta)
|
||||
@ -65,7 +67,7 @@ public fun <R : Any> DataSet<*>.select(
|
||||
*/
|
||||
public inline fun <reified R : Any> DataSet<*>.select(
|
||||
namePattern: Name? = null,
|
||||
noinline filter: (name: Name, meta: Meta) -> Boolean = { _, _ -> true }
|
||||
noinline filter: (name: Name, meta: Meta) -> Boolean = { _, _ -> true },
|
||||
): DataSet<R> = select(typeOf<R>(), namePattern, filter)
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user