Fix falling empty maps back to their schema's default values
This commit is contained in:
@@ -17,8 +17,4 @@ class ConfigMap(private val map: Map<Value, Value>) {
|
||||
fun containsKey(key: String): Boolean {
|
||||
return raw.containsKey(key)
|
||||
}
|
||||
|
||||
companion object {
|
||||
val EMPTY = ConfigMap(emptyMap())
|
||||
}
|
||||
}
|
||||
@@ -36,4 +36,6 @@ class ConfigMapSchema {
|
||||
else Value.string(name) to value
|
||||
}.toMap())
|
||||
}
|
||||
|
||||
fun empty(): ConfigMap = parse(Value.map(emptyMap()))
|
||||
}
|
||||
@@ -13,7 +13,6 @@ import io.smnp.type.matcher.Matcher.Companion.listOfMatchers
|
||||
import io.smnp.type.matcher.Matcher.Companion.mapOfMatchers
|
||||
import io.smnp.type.matcher.Matcher.Companion.ofType
|
||||
import io.smnp.type.model.Value
|
||||
import io.smnp.util.config.ConfigMap
|
||||
import io.smnp.util.config.ConfigMapSchema
|
||||
|
||||
|
||||
@@ -47,7 +46,7 @@ class MidiFunction : Function("midi") {
|
||||
throw CustomException("MIDI standard supports max to 16 channels and that number has been exceeded")
|
||||
}
|
||||
|
||||
Midi.with(ConfigMap.EMPTY).play(unwrappedLines)
|
||||
Midi.with(schema.empty()).play(unwrappedLines)
|
||||
|
||||
Value.void()
|
||||
}
|
||||
@@ -74,7 +73,7 @@ class MidiFunction : Function("midi") {
|
||||
throw CustomException("MIDI standard supports max to 16 channels and that number has been exceeded")
|
||||
}
|
||||
|
||||
Midi.with(ConfigMap.EMPTY).play(unwrappedChannels)
|
||||
Midi.with(schema.empty()).play(unwrappedChannels)
|
||||
|
||||
Value.void()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user