Fixed Toml decoding when table array defined before parent #1922

This commit is contained in:
Mike Farah
2024-02-15 16:15:01 +11:00
parent c32a9ceab8
commit d9e1a789ea
4 changed files with 42 additions and 10 deletions
+11
View File
@@ -26,6 +26,17 @@ func (d *dataTreeNavigator) DeeplyAssign(context Context, path []interface{}, rh
assignmentOp := &Operation{OperationType: assignOpType, Preferences: assignPreferences{}}
if rhsCandidateNode.Kind == MappingNode {
log.Debug("[DataTreeNavigator] DeeplyAssign: deeply merging object")
// if the rhs is a map, we need to deeply merge it in.
// otherwise we'll clobber any existing fields
assignmentOp = &Operation{OperationType: multiplyAssignOpType, Preferences: multiplyPreferences{
AppendArrays: true,
TraversePrefs: traversePreferences{DontFollowAlias: true},
AssignPrefs: assignPreferences{},
}}
}
rhsOp := &Operation{OperationType: valueOpType, CandidateNode: rhsCandidateNode}
assignmentOpNode := &ExpressionNode{