Skip to content

Commit

Permalink
fixes to Tree::merge_with()
Browse files Browse the repository at this point in the history
  • Loading branch information
biojppm committed Jun 23, 2019
1 parent b824fcf commit 8c34ec0
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions src/c4/yml/tree.cpp
Expand Up @@ -886,7 +886,14 @@ void Tree::merge_with(Tree const *src, size_t src_node, size_t dst_node)
{
remove_children(dst_node);
}
to_seq(dst_node);
if(src->has_key(src_node))
{
to_seq(dst_node, src->key(src_node));
}
else
{
to_seq(dst_node);
}
}
for(size_t sch = src->first_child(src_node); sch != NONE; sch = src->next_sibling(sch))
{
Expand All @@ -904,7 +911,14 @@ void Tree::merge_with(Tree const *src, size_t src_node, size_t dst_node)
{
remove_children(dst_node);
}
to_map(dst_node);
if(src->has_key(src_node))
{
to_map(dst_node, src->key(src_node));
}
else
{
to_map(dst_node);
}
}
for(size_t sch = src->first_child(src_node); sch != NONE; sch = src->next_sibling(sch))
{
Expand Down

0 comments on commit 8c34ec0

Please sign in to comment.