Skip to content

Commit

Permalink
Merge pull request #1 from Heromyth/master
Browse files Browse the repository at this point in the history
Support DMD 2.078
  • Loading branch information
Kozzi11 authored Jan 14, 2018
2 parents 9e71e89 + 3a9c7ba commit 85d6420
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
9 changes: 4 additions & 5 deletions source/std/experimental/xml/domimpl.d
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,11 @@ import std.experimental.allocator.gc_allocator;
// this is needed because compilers up to at least DMD 2.071.1 suffer from issue 16319
private auto multiVersionMake(Type, Allocator, Args...)(ref Allocator allocator, auto ref Args args)
{
static if (__traits(compiles, allocator.make!Type(args)))
static if (Args.length == 0 && __traits(compiles, allocator.make!Type(args)))
return allocator.make!Type(args);
else static if (Args.length > 0 && __traits(compiles, allocator.make!Type(args[1..$])))
else static if (Args.length > 0 && __traits(compiles, allocator.make!Type(args[0 .. $])))
{
auto res = allocator.make!Type(args[1..$]);
res.outer = args[0];
auto res = allocator.make!Type(args[0 .. $]);
return res;
}
else
Expand Down Expand Up @@ -2390,7 +2389,7 @@ class DOMImplementation(DOMString, Alloc = shared(GCAllocator), ErrorHandler = b
else
alias MapToConfigName = AliasSeq!();
}
private static immutable string[] arr = [MapToConfigName!(__traits(allMembers, Params))];
static immutable string[] arr = [MapToConfigName!(__traits(allMembers, Params))];

// specific to DOMStringList
override
Expand Down
11 changes: 8 additions & 3 deletions source/std/experimental/xml/package.d
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,14 @@
+
+ // write it out to "catalogue.xml"
+ auto file = File("catalogue.xml", "w");
+ file.lockingTextWriter
+ .writerFor!string // instatiates an xml writer on top of an output range
+ .writeDOM(dom); // write the document with all of its children
+
+ auto textWriter = file.lockingTextWriter; // instatiates an xml writer on top of an output range
+ textWriter.writerFor!string.writeDOM(dom); // write the document with all of its children
+
+ // bug:
+ // file.lockingTextWriter
+ // .writerFor!string // instatiates an xml writer on top of an output range
+ // .writeDOM(dom); // write the document with all of its children
+ -----
+
+ Also available is a SAX parser, which we will use to find all text nodes containing
Expand Down
2 changes: 1 addition & 1 deletion source/std/experimental/xml/writer.d
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,7 @@ void writeDOM(WriterType, NodeType)(auto ref WriterType writer, NodeType node)
foreach (attr; elem.attributes)
writer.writeAttribute(attr.nodeName, attr.value);
foreach (child; elem.childNodes)
writer.writeDOM(elem);
writer.writeDOM(child);
writer.closeElement(elem.tagName);
break;
case text:
Expand Down

0 comments on commit 85d6420

Please sign in to comment.