DUB forced property fix.

This commit is contained in:
Kiith-Sa 2013-04-24 01:32:16 +02:00
parent f1438ec0d3
commit 2e3c6fe445
8 changed files with 37 additions and 30 deletions

View file

@ -1,9 +1,16 @@
{ {
"name": "dyaml", "description": "YAML parser and emitter",
"description": "YAML parser and emitter", "authors": [
"homepage": "http://dyaml.alwaysdata.net/", "Ferdinand Majerech"
"copyright": "Copyright © 2011, Ferdinand Majerech", ],
"authors": ["Ferdinand Majerech"], "libs": [],
"license": "Boost 1.0", "targetType": "staticLibrary",
"dependencies": {} "importPaths": ["source"],
"version": "~master",
"license": "Boost 1.0",
"dependencies": {},
"homepage": "http://dyaml.alwaysdata.net/",
"name": "dyaml",
"copyright": "Copyright © 2011-2013, Ferdinand Majerech",
"buildRequirements": ["relaxProperties"],
} }

View file

@ -376,7 +376,7 @@ final class Constructor
} }
//Get the array of constructor functions for scalar, sequence or mapping. //Get the array of constructor functions for scalar, sequence or mapping.
auto delegates(T)() pure @safe nothrow @property auto delegates(T)() pure @safe nothrow
{ {
static if(is(T : string)) {return &fromScalar_;} static if(is(T : string)) {return &fromScalar_;}
else static if(is(T : Node[])) {return &fromSequence_;} else static if(is(T : Node[])) {return &fromSequence_;}

View file

@ -1554,7 +1554,7 @@ struct ScalarWriter
private: private:
///Get next character and move end of the text range to it. ///Get next character and move end of the text range to it.
dchar nextChar() pure @safe @property dchar nextChar() pure @safe
{ {
++endChar_; ++endChar_;
endByte_ = nextEndByte_; endByte_ = nextEndByte_;
@ -1570,14 +1570,14 @@ struct ScalarWriter
} }
///Get character at start of the text range. ///Get character at start of the text range.
dchar charAtStart() const pure @safe @property dchar charAtStart() const pure @safe
{ {
size_t idx = startByte_; size_t idx = startByte_;
return decode(text_, idx); return decode(text_, idx);
} }
///Is the current line too wide? ///Is the current line too wide?
bool tooWide() const pure @safe nothrow @property bool tooWide() const pure @safe nothrow
{ {
return startChar_ + 1 == endChar_ && return startChar_ + 1 == endChar_ &&
emitter_.column_ > emitter_.bestWidth_; emitter_.column_ > emitter_.bestWidth_;

View file

@ -581,7 +581,7 @@ struct Node
{ {
return (cast(YAMLContainer!T)object).value_; return (cast(YAMLContainer!T)object).value_;
} }
throw new Error("Node stores unexpected type: " ~ object.type.toString ~ throw new Error("Node stores unexpected type: " ~ object.type.toString() ~
". Expected: " ~ typeid(T).toString, startMark_); ". Expected: " ~ typeid(T).toString, startMark_);
} }
@ -594,7 +594,7 @@ struct Node
static if(!stringConversion) static if(!stringConversion)
{ {
if(isString){return to!T(value_.get!string);} if(isString){return to!T(value_.get!string);}
throw new Error("Node stores unexpected type: " ~ type.toString ~ throw new Error("Node stores unexpected type: " ~ type.toString() ~
". Expected: " ~ typeid(T).toString, startMark_); ". Expected: " ~ typeid(T).toString, startMark_);
} }
else else
@ -622,12 +622,12 @@ struct Node
{ {
const temp = value_.get!(const long); const temp = value_.get!(const long);
enforce(temp >= T.min && temp <= T.max, enforce(temp >= T.min && temp <= T.max,
new Error("Integer value of type " ~ typeid(T).toString ~ new Error("Integer value of type " ~ typeid(T).toString() ~
" out of range. Value: " ~ to!string(temp), startMark_)); " out of range. Value: " ~ to!string(temp), startMark_));
return to!T(temp); return to!T(temp);
} }
throw new Error("Node stores unexpected type: " ~ type.toString ~ throw new Error("Node stores unexpected type: " ~ type.toString() ~
". Expected: " ~ typeid(T).toString, startMark_); ". Expected: " ~ typeid(T).toString(), startMark_);
} }
assert(false, "This code should never be reached"); assert(false, "This code should never be reached");
} }
@ -651,7 +651,7 @@ struct Node
{ {
return (cast(const YAMLContainer!(Unqual!T))object).value_; return (cast(const YAMLContainer!(Unqual!T))object).value_;
} }
throw new Error("Node has unexpected type: " ~ object.type.toString ~ throw new Error("Node has unexpected type: " ~ object.type.toString() ~
". Expected: " ~ typeid(T).toString, startMark_); ". Expected: " ~ typeid(T).toString, startMark_);
} }
@ -664,8 +664,8 @@ struct Node
static if(!stringConversion) static if(!stringConversion)
{ {
if(isString){return to!T(value_.get!(const string));} if(isString){return to!T(value_.get!(const string));}
throw new Error("Node stores unexpected type: " ~ type.toString ~ throw new Error("Node stores unexpected type: " ~ type.toString() ~
". Expected: " ~ typeid(T).toString, startMark_); ". Expected: " ~ typeid(T).toString(), startMark_);
} }
else else
{ {
@ -693,11 +693,11 @@ struct Node
{ {
const temp = value_.get!(const long); const temp = value_.get!(const long);
enforce(temp >= T.min && temp <= T.max, enforce(temp >= T.min && temp <= T.max,
new Error("Integer value of type " ~ typeid(T).toString ~ new Error("Integer value of type " ~ typeid(T).toString() ~
" out of range. Value: " ~ to!string(temp), startMark_)); " out of range. Value: " ~ to!string(temp), startMark_));
return to!T(temp); return to!T(temp);
} }
throw new Error("Node stores unexpected type: " ~ type.toString ~ throw new Error("Node stores unexpected type: " ~ type.toString() ~
". Expected: " ~ typeid(T).toString, startMark_); ". Expected: " ~ typeid(T).toString, startMark_);
} }
} }
@ -1536,7 +1536,7 @@ struct Node
{ {
return value_.get!(const YAMLObject).cmp(rhs.value_.get!(const YAMLObject)); return value_.get!(const YAMLObject).cmp(rhs.value_.get!(const YAMLObject));
} }
assert(false, "Unknown type of node for comparison : " ~ type.toString); assert(false, "Unknown type of node for comparison : " ~ type.toString());
} }
/* /*
@ -1576,7 +1576,7 @@ struct Node
if(isScalar) if(isScalar)
{ {
return indent ~ "scalar(" ~ return indent ~ "scalar(" ~
(convertsTo!string ? get!string : type.toString) ~ ")\n"; (convertsTo!string ? get!string : type.toString()) ~ ")\n";
} }
assert(false); assert(false);
} }
@ -1626,7 +1626,7 @@ struct Node
} }
//Determine if the value can be converted to specified type. //Determine if the value can be converted to specified type.
bool convertsTo(T)() const @safe @property bool convertsTo(T)() const @safe
{ {
if(isType!T){return true;} if(isType!T){return true;}

View file

@ -710,7 +710,7 @@ final class Parser
} }
else else
{ {
immutable token = scanner_.peekToken; immutable token = scanner_.peekToken();
throw new Error("While parsing a flow sequence", marks_.back, throw new Error("While parsing a flow sequence", marks_.back,
"expected ',' or ']', but got: " ~ "expected ',' or ']', but got: " ~
token.idString, token.startMark); token.idString, token.startMark);
@ -818,7 +818,7 @@ final class Parser
} }
else else
{ {
immutable token = scanner_.peekToken; immutable token = scanner_.peekToken();
throw new Error("While parsing a flow mapping", marks_.back, throw new Error("While parsing a flow mapping", marks_.back,
"expected ',' or '}', but got: " ~ "expected ',' or '}', but got: " ~
token.idString, token.startMark); token.idString, token.startMark);

View file

@ -509,7 +509,7 @@ Node representReal(ref Node node, Representer representer) @system
string value = isNaN(f) ? ".nan": string value = isNaN(f) ? ".nan":
f == real.infinity ? ".inf": f == real.infinity ? ".inf":
f == -1.0 * real.infinity ? "-.inf": f == -1.0 * real.infinity ? "-.inf":
{auto a = appender!string; {auto a = appender!string();
formattedWrite(a, "%12f", f); formattedWrite(a, "%12f", f);
return a.data.strip();}(); return a.data.strip();}();

View file

@ -231,7 +231,7 @@ final class Scanner
private: private:
///Determine whether or not we need to fetch more tokens before peeking/getting a token. ///Determine whether or not we need to fetch more tokens before peeking/getting a token.
bool needMoreTokens() pure @safe @property bool needMoreTokens() pure @safe
{ {
if(done_) {return false;} if(done_) {return false;}
if(tokens_.empty){return true;} if(tokens_.empty){return true;}
@ -1188,7 +1188,7 @@ final class Scanner
void scanBlockScalarIgnoredLine(const Mark startMark) @trusted void scanBlockScalarIgnoredLine(const Mark startMark) @trusted
{ {
findNextNonSpace(); findNextNonSpace();
if(reader_.peek == '#'){scanToNextBreak();} if(reader_.peek()== '#'){scanToNextBreak();}
enforce("\0\n\r\u0085\u2028\u2029"d.canFind(reader_.peek()), enforce("\0\n\r\u0085\u2028\u2029"d.canFind(reader_.peek()),
new Error("While scanning a block scalar", startMark, new Error("While scanning a block scalar", startMark,

View file

@ -162,7 +162,7 @@ struct Serializer
Anchor generateAnchor() @trusted Anchor generateAnchor() @trusted
{ {
++lastAnchorID_; ++lastAnchorID_;
auto appender = appender!string; auto appender = appender!string();
formattedWrite(appender, "id%03d", lastAnchorID_); formattedWrite(appender, "id%03d", lastAnchorID_);
return Anchor(appender.data); return Anchor(appender.data);
} }