diff --git a/fsm/common/src/commonMain/kotlin/dev/inmo/micro_utils/fsm/common/dsl/FSMBuilder.kt b/fsm/common/src/commonMain/kotlin/dev/inmo/micro_utils/fsm/common/dsl/FSMBuilder.kt index d0378c88d0f..0668693b956 100644 --- a/fsm/common/src/commonMain/kotlin/dev/inmo/micro_utils/fsm/common/dsl/FSMBuilder.kt +++ b/fsm/common/src/commonMain/kotlin/dev/inmo/micro_utils/fsm/common/dsl/FSMBuilder.kt @@ -7,7 +7,7 @@ import kotlin.reflect.KClass class FSMBuilder( var statesManager: StatesManager = DefaultStatesManager(InMemoryDefaultStatesManagerRepo()), - val fsmBuilder: (states: List>, statesManager: StatesManager) -> StatesMachine = { states, statesManager -> + val fsmBuilder: (statesManager: StatesManager, states: List>) -> StatesMachine = { statesManager, states -> StatesMachine( statesManager, states @@ -49,10 +49,10 @@ class FSMBuilder( } fun build() = fsmBuilder( + statesManager, states.toList().let { list -> defaultStateHandler ?.let { list + it.holder { true } } ?: list - }, - statesManager + } ) }