Skip to content

Commit

Permalink
Merge branch 'content-poly-bug2' into content-polymorphic-serializer
Browse files Browse the repository at this point in the history
  • Loading branch information
Jojo4GH committed Sep 16, 2024
2 parents 3d75137 + 288863e commit baaf876
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/commonMain/kotlin/com/charleskorn/kaml/YamlListInput.kt
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ internal class YamlListInput(val list: YamlList, yaml: Yaml, context: Serializer
override fun decodeEnum(enumDescriptor: SerialDescriptor): Int = currentElementDecoder.decodeEnum(enumDescriptor)

override fun <T> decodeSerializableValue(deserializer: DeserializationStrategy<T>): T {
if (!haveStartedReadingElements) return super.decodeSerializableValue(deserializer)
if (!haveStartedReadingElements) {
return super.decodeSerializableValue(deserializer)
}
return currentElementDecoder.decodeSerializableValue(deserializer)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,12 @@ internal sealed class YamlMapLikeInputBase(map: YamlMap, yaml: Yaml, context: Se
override fun decodeEnum(enumDescriptor: SerialDescriptor): Int = fromCurrentValue { decodeEnum(enumDescriptor) }

override fun <T> decodeSerializableValue(deserializer: DeserializationStrategy<T>): T {
if (!haveStartedReadingEntries) return super.decodeSerializableValue(deserializer)
return fromCurrentValue { decodeSerializableValue(deserializer) }
if (!haveStartedReadingEntries) {
return super.decodeSerializableValue(deserializer)
}
return fromCurrentValue {
decodeSerializableValue(deserializer)
}
}

protected fun <T> fromCurrentValue(action: YamlInput.() -> T): T {
Expand Down

0 comments on commit baaf876

Please sign in to comment.