File tree Expand file tree Collapse file tree 2 files changed +5
-9
lines changed
src/main/kotlin/de/fruxz/sparkle/framework/infrastructure/command Expand file tree Collapse file tree 2 files changed +5
-9
lines changed Original file line number Diff line number Diff line change @@ -54,8 +54,8 @@ data class CompletionAsset<T>(
5454 override val identityKey : Key ,
5555 val refreshing : Boolean ,
5656 val supportedInputType : List <InterchangeStructureInputRestriction <* >> = listOf(InterchangeStructureInputRestriction .STRING ),
57- var check : (CompletionContext .() -> Boolean )? = null ,
58- var transformer : (CompletionContext .() -> T ? )? = null ,
57+ val check : (CompletionContext .() -> Boolean )? = null ,
58+ val transformer : (CompletionContext .() -> T ? )? = null ,
5959 val generator : CompletionContext .(CompletionAsset <T >) -> Collection <String >,
6060) : KeyedIdentifiable<CompletionAsset<T>> {
6161
@@ -74,13 +74,9 @@ data class CompletionAsset<T>(
7474 }
7575 }
7676
77- fun doCheck (check : (CompletionContext .() -> Boolean )? ) = apply {
78- this .check = check
79- }
77+ fun doCheck (check : (CompletionContext .() -> Boolean )? ) = copy(check = check)
8078
81- fun transformer (transformer : (CompletionContext .() -> T ? )? ) = apply {
82- this .transformer = transformer
83- }
79+ fun transformer (transformer : (CompletionContext .() -> T ? )? ) = copy(transformer = transformer)
8480
8581 companion object {
8682
Original file line number Diff line number Diff line change @@ -101,7 +101,7 @@ data class InterchangeAccess<EXECUTOR : InterchangeExecutor>(
101101 fun <T : Any > getInput (slot : Int = inputLength - 1, fromAsset : CompletionAsset <T >): T {
102102 if (fromAsset.transformer == null ) throw IllegalArgumentException (" Asset '${fromAsset.identity} ' provides no transformer!" )
103103
104- return getInput(slot).let { input -> fromAsset.transformer? .invoke(
104+ return getInput(slot).let { input -> fromAsset.transformer.invoke(
105105 CompletionAsset .CompletionContext (
106106 executor = executor,
107107 fullLineInput = parameters,
You can’t perform that action at this time.
0 commit comments