dyaml.node.merge() usage fix.

This commit is contained in:
Kiith-Sa 2012-12-27 22:00:31 +01:00
parent 900bd51d52
commit f06cb132a3
2 changed files with 7 additions and 3 deletions

View file

@ -262,7 +262,11 @@ final class Composer
foreach(ref Node key, ref Node value; root) foreach(ref Node key, ref Node value; root)
{ {
if(key.isType!YAMLMerge){toMerge ~= value;} if(key.isType!YAMLMerge){toMerge ~= value;}
else{merge(result, Node.Pair(key, value));} else
{
auto temp = Node.Pair(key, value);
merge(result, temp);
}
} }
foreach(node; toMerge) foreach(node; toMerge)
{ {

View file

@ -17,7 +17,7 @@ import std.datetime;
import std.exception; import std.exception;
import std.math; import std.math;
import std.range; import std.range;
import std.stdio; import std.stdio;
import std.string; import std.string;
import std.traits; import std.traits;
import std.typecons; import std.typecons;
@ -1779,7 +1779,7 @@ package:
* Params: pairs = Array of pairs to merge into. * Params: pairs = Array of pairs to merge into.
* toMerge = Pair to merge. * toMerge = Pair to merge.
*/ */
void merge(ref Node.Pair[] pairs, ref Node.Pair toMerge) @safe void merge(ref Node.Pair[] pairs, ref Node.Pair toMerge) @safe
{ {
foreach(ref pair; pairs) foreach(ref pair; pairs)
{ {