Temporaries in constructor.d due to changes in ref passing (by John Colvin).
This commit is contained in:
parent
ea0237c716
commit
539f5837d6
|
@ -328,6 +328,7 @@ final class Constructor
|
||||||
enforce((tag in *delegates!T) !is null,
|
enforce((tag in *delegates!T) !is null,
|
||||||
new Error("No constructor function from " ~ type ~
|
new Error("No constructor function from " ~ type ~
|
||||||
" for tag " ~ tag.get(), start, end));
|
" for tag " ~ tag.get(), start, end));
|
||||||
|
|
||||||
Node node = Node(value);
|
Node node = Node(value);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -458,7 +459,8 @@ unittest
|
||||||
{
|
{
|
||||||
long getLong(string str)
|
long getLong(string str)
|
||||||
{
|
{
|
||||||
return constructLong(Node(str));
|
auto node = Node(str);
|
||||||
|
return constructLong(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
string canonical = "685230";
|
string canonical = "685230";
|
||||||
|
@ -528,7 +530,8 @@ unittest
|
||||||
|
|
||||||
real getReal(string str)
|
real getReal(string str)
|
||||||
{
|
{
|
||||||
return constructReal(Node(str));
|
auto node = Node(str);
|
||||||
|
return constructReal(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
string canonical = "6.8523015e+5";
|
string canonical = "6.8523015e+5";
|
||||||
|
@ -570,7 +573,8 @@ unittest
|
||||||
char[] buffer;
|
char[] buffer;
|
||||||
buffer.length = 256;
|
buffer.length = 256;
|
||||||
string input = cast(string)Base64.encode(test, buffer);
|
string input = cast(string)Base64.encode(test, buffer);
|
||||||
auto value = constructBinary(Node(input));
|
auto node = Node(input);
|
||||||
|
auto value = constructBinary(node);
|
||||||
assert(value == test);
|
assert(value == test);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -651,7 +655,8 @@ unittest
|
||||||
|
|
||||||
string timestamp(string value)
|
string timestamp(string value)
|
||||||
{
|
{
|
||||||
return constructTimestamp(Node(value)).toISOString();
|
auto node = Node(value);
|
||||||
|
return constructTimestamp(node).toISOString();
|
||||||
}
|
}
|
||||||
|
|
||||||
string canonical = "2001-12-15T02:59:43.1Z";
|
string canonical = "2001-12-15T02:59:43.1Z";
|
||||||
|
@ -745,7 +750,8 @@ unittest
|
||||||
|
|
||||||
bool hasDuplicates(Node[] nodes)
|
bool hasDuplicates(Node[] nodes)
|
||||||
{
|
{
|
||||||
return null !is collectException(constructOrderedMap(Node(nodes)));
|
auto node = Node(nodes);
|
||||||
|
return null !is collectException(constructOrderedMap(node));
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(hasDuplicates(alternateTypes(8) ~ alternateTypes(2)));
|
assert(hasDuplicates(alternateTypes(8) ~ alternateTypes(2)));
|
||||||
|
@ -816,14 +822,15 @@ unittest
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(null !is collectException
|
auto nodeDuplicatesShort = Node(DuplicatesShort.dup);
|
||||||
(constructSet(Node(DuplicatesShort.dup))));
|
auto nodeNoDuplicatesShort = Node(noDuplicatesShort.dup);
|
||||||
assert(null is collectException
|
auto nodeDuplicatesLong = Node(DuplicatesLong.dup);
|
||||||
(constructSet(Node(noDuplicatesShort.dup))));
|
auto nodeNoDuplicatesLong = Node(noDuplicatesLong.dup);
|
||||||
assert(null !is collectException
|
|
||||||
(constructSet(Node(DuplicatesLong.dup))));
|
assert(null !is collectException(constructSet(nodeDuplicatesShort)));
|
||||||
assert(null is collectException
|
assert(null is collectException(constructSet(nodeNoDuplicatesShort)));
|
||||||
(constructSet(Node(noDuplicatesLong.dup))));
|
assert(null !is collectException(constructSet(nodeDuplicatesLong)));
|
||||||
|
assert(null is collectException(constructSet(nodeNoDuplicatesLong)));
|
||||||
}
|
}
|
||||||
|
|
||||||
///Construct a sequence (array) _node.
|
///Construct a sequence (array) _node.
|
||||||
|
|
Loading…
Reference in a new issue