Assisted-by: GLM 5.3 Flash
This commit is contained in:
@@ -18,9 +18,13 @@ import (
|
||||
// decoder maps a parsed TOML tree onto Go values via reflection. ctx is the
|
||||
// context a cancellable entry point handed in, and reaches an
|
||||
// UnmarshalerContext destination; entry points without one leave it nil.
|
||||
// nodes is the document's node index, present only when a destination can
|
||||
// reach an OrderedMap and the parse built the tree its key order is read
|
||||
// from.
|
||||
type decoder struct {
|
||||
disallowUnknown bool
|
||||
ctx context.Context
|
||||
nodes nodeIndex
|
||||
}
|
||||
|
||||
func newDecoder() *decoder { return &decoder{} }
|
||||
@@ -273,6 +277,9 @@ func textUnmarshalerOf(dst reflect.Value) (encoding.TextUnmarshaler, bool) {
|
||||
}
|
||||
|
||||
func (d *decoder) assignTable(tbl map[string]any, dst reflect.Value) error {
|
||||
if dst.Type() == orderedMapType {
|
||||
return d.fillOrderedMap(tbl, dst)
|
||||
}
|
||||
switch dst.Kind() {
|
||||
case reflect.Struct:
|
||||
return d.assignStruct(tbl, dst)
|
||||
|
||||
Reference in New Issue
Block a user