DMD 2.053 compatibility.
This commit is contained in:
parent
2e3c6fe445
commit
a409cceeff
|
@ -618,7 +618,7 @@ SysTime constructTimestamp(ref Node node)
|
||||||
value = matches.front.post;
|
value = matches.front.post;
|
||||||
matches = match(value, TZRegexp);
|
matches = match(value, TZRegexp);
|
||||||
if(matches.empty || matches.front.captures[0] == "Z")
|
if(matches.empty || matches.front.captures[0] == "Z")
|
||||||
{
|
{
|
||||||
return SysTime(DateTime(year, month, day, hour, minute, second),
|
return SysTime(DateTime(year, month, day, hour, minute, second),
|
||||||
FracSec.from!"hnsecs"(hectonanosecond), UTC());
|
FracSec.from!"hnsecs"(hectonanosecond), UTC());
|
||||||
}
|
}
|
||||||
|
@ -631,12 +631,12 @@ SysTime constructTimestamp(ref Node node)
|
||||||
if(captures[1][0] == '-'){sign = -1;}
|
if(captures[1][0] == '-'){sign = -1;}
|
||||||
tzHours = to!int(captures[1][1 .. $]);
|
tzHours = to!int(captures[1][1 .. $]);
|
||||||
}
|
}
|
||||||
const tzMinutes = (!captures[2].empty) ? to!int(captures[2][1 .. $]) : 0;
|
auto tzMinutes = (!captures[2].empty) ? to!int(captures[2][1 .. $]) : 0;
|
||||||
const tzOffset = sign * (60 * tzHours + tzMinutes);
|
auto tzOffset = sign * (60 * tzHours + tzMinutes);
|
||||||
|
|
||||||
return SysTime(DateTime(year, month, day, hour, minute, second),
|
return SysTime(DateTime(year, month, day, hour, minute, second),
|
||||||
FracSec.from!"hnsecs"(hectonanosecond),
|
FracSec.from!"hnsecs"(hectonanosecond),
|
||||||
new SimpleTimeZone(tzOffset));
|
new immutable SimpleTimeZone(tzOffset));
|
||||||
}
|
}
|
||||||
catch(ConvException e)
|
catch(ConvException e)
|
||||||
{
|
{
|
||||||
|
|
|
@ -259,15 +259,17 @@ struct Node
|
||||||
}
|
}
|
||||||
unittest
|
unittest
|
||||||
{
|
{
|
||||||
with(Node(42))
|
|
||||||
{
|
{
|
||||||
assert(isScalar() && !isSequence && !isMapping && !isUserType);
|
auto node = Node(42);
|
||||||
assert(as!int == 42 && as!float == 42.0f && as!string == "42");
|
assert(node.isScalar && !node.isSequence &&
|
||||||
assert(!isUserType());
|
!node.isMapping && !node.isUserType);
|
||||||
|
assert(node.as!int == 42 && node.as!float == 42.0f && node.as!string == "42");
|
||||||
|
assert(!node.isUserType);
|
||||||
}
|
}
|
||||||
with(Node(new class{int a = 5;}))
|
|
||||||
{
|
{
|
||||||
assert(isUserType());
|
auto node = Node(new class{int a = 5;});
|
||||||
|
assert(node.isUserType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1677,9 +1679,9 @@ struct Node
|
||||||
{
|
{
|
||||||
static long getIndex(ref Node node, ref T rhs)
|
static long getIndex(ref Node node, ref T rhs)
|
||||||
{
|
{
|
||||||
foreach(idx, ref elem; node.get!(Node[])) with(elem)
|
foreach(idx, ref elem; node.get!(Node[]))
|
||||||
{
|
{
|
||||||
if(convertsTo!T && as!(T, No.stringConversion) == rhs)
|
if(elem.convertsTo!T && elem.as!(T, No.stringConversion) == rhs)
|
||||||
{
|
{
|
||||||
return idx;
|
return idx;
|
||||||
}
|
}
|
||||||
|
|
|
@ -276,8 +276,8 @@ Node[] timestampBugs()
|
||||||
return [Node([Node(SysTime(DateTime(2001, 12, 15, 3, 29, 43), FracSec.from!"hnsecs"(1000000), UTC())),
|
return [Node([Node(SysTime(DateTime(2001, 12, 15, 3, 29, 43), FracSec.from!"hnsecs"(1000000), UTC())),
|
||||||
Node(SysTime(DateTime(2001, 12, 14, 16, 29, 43), FracSec.from!"hnsecs"(1000000), UTC())),
|
Node(SysTime(DateTime(2001, 12, 14, 16, 29, 43), FracSec.from!"hnsecs"(1000000), UTC())),
|
||||||
Node(SysTime(DateTime(2001, 12, 14, 21, 59, 43), FracSec.from!"hnsecs"(10100), UTC())),
|
Node(SysTime(DateTime(2001, 12, 14, 21, 59, 43), FracSec.from!"hnsecs"(10100), UTC())),
|
||||||
Node(SysTime(DateTime(2001, 12, 14, 21, 59, 43), new SimpleTimeZone(60))),
|
Node(SysTime(DateTime(2001, 12, 14, 21, 59, 43), new immutable SimpleTimeZone(60))),
|
||||||
Node(SysTime(DateTime(2001, 12, 14, 21, 59, 43), new SimpleTimeZone(-90))),
|
Node(SysTime(DateTime(2001, 12, 14, 21, 59, 43), new immutable SimpleTimeZone(-90))),
|
||||||
Node(SysTime(DateTime(2005, 7, 8, 17, 35, 4), FracSec.from!"hnsecs"(5176000), UTC()))])];
|
Node(SysTime(DateTime(2005, 7, 8, 17, 35, 4), FracSec.from!"hnsecs"(5176000), UTC()))])];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue