static void MergeIntoResolved(MiniYamlNode overrideNode, List <MiniYamlNode> existingNodes, Dictionary <string, MiniYaml> tree, Dictionary <string, MiniYamlNode.SourceLocation> inherited) { var existingNode = existingNodes.FirstOrDefault(n => n.Key == overrideNode.Key); if (existingNode != null) { existingNode.Value = MiniYaml.MergePartial(existingNode.Value, overrideNode.Value); existingNode.Value.Nodes = ResolveInherits(existingNode.Key, existingNode.Value, tree, inherited); } else { existingNodes.Add(overrideNode.Clone()); } }
static MiniYaml MergeWithParents(MiniYaml node, Dictionary <string, MiniYaml> allUnits, HashSet <string> allParents) { var parents = GetParents(node, allUnits); foreach (var kv in parents) { if (!allParents.Add(kv.Key)) { throw new YamlException( "Bogus inheritance -- duplicate inheritance of {0}.".F(kv.Key)); } node = MiniYaml.MergePartial(node, MergeWithParents(kv.Value, allUnits, allParents)); } return(node); }