Skip to content

Commit

Permalink
Fixed compilation with DMD 2.068
Browse files Browse the repository at this point in the history
Had to use a lot of @trusted as std.variant.VariantN is again less safe.
Will need to change that back once it gets safer, or at least isolate
code using it so that half of Node API doesn't need to be @trusted.
  • Loading branch information
kiith-sa committed Aug 23, 2015
1 parent b5e028d commit 2f3d782
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
26 changes: 13 additions & 13 deletions source/dyaml/node.d
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ struct Node
}
/// Ditto.
// Overload for types where we can make this nothrow.
this(T)(T value, const string tag = null) @safe pure nothrow
this(T)(T value, const string tag = null) @trusted pure nothrow
if(scalarCtorNothrow!T)
{
tag_ = Tag(tag);
Expand Down Expand Up @@ -321,7 +321,7 @@ struct Node
* auto set = Node([1, 2, 3, 4, 5], "tag:yaml.org,2002:set");
* --------------------
*/
this(T)(T[] array, const string tag = null) @safe
this(T)(T[] array, const string tag = null) @trusted
if (!isSomeString!(T[]))
{
tag_ = Tag(tag);
Expand Down Expand Up @@ -385,7 +385,7 @@ struct Node
* auto pairs = Node([1 : "a", 2 : "b"], "tag:yaml.org,2002:pairs");
* --------------------
*/
this(K, V)(V[K] array, const string tag = null) @safe
this(K, V)(V[K] array, const string tag = null) @trusted
{
tag_ = Tag(tag);

Expand Down Expand Up @@ -449,7 +449,7 @@ struct Node
* auto pairs = Node([1, 2], ["a", "b"], "tag:yaml.org,2002:pairs");
* --------------------
*/
this(K, V)(K[] keys, V[] values, const string tag = null) @safe
this(K, V)(K[] keys, V[] values, const string tag = null) @trusted
if(!(isSomeString!(K[]) || isSomeString!(V[])))
in
{
Expand Down Expand Up @@ -740,7 +740,7 @@ struct Node
*
* Throws: NodeException if this is not a sequence nor a mapping.
*/
@property size_t length() const @safe
@property size_t length() const @trusted
{
if(isSequence) {return value_.get!(const Node[]).length;}
else if(isMapping){return value_.get!(const Pair[]).length;}
Expand Down Expand Up @@ -960,7 +960,7 @@ struct Node
* Throws: NodeException if the node is not a collection, index is out
* of range or if a non-integral index is used on a sequence node.
*/
void opIndexAssign(K, V)(V value, K index) @safe
void opIndexAssign(K, V)(V value, K index) @trusted
{
if(isSequence())
{
Expand Down Expand Up @@ -1187,7 +1187,7 @@ struct Node
*
* Params: value = Value to _add to the sequence.
*/
void add(T)(T value) @safe
void add(T)(T value) @trusted
{
enforce(isSequence(),
new Error("Trying to add an element to a " ~ nodeTypeString ~ " node", startMark_));
Expand Down Expand Up @@ -1223,7 +1223,7 @@ struct Node
* Params: key = Key to _add.
* value = Value to _add.
*/
void add(K, V)(K key, V value) @safe
void add(K, V)(K key, V value) @trusted
{
enforce(isMapping(),
new Error("Trying to add a key-value pair to a " ~
Expand Down Expand Up @@ -1405,7 +1405,7 @@ struct Node
// Returns: Constructed node.
static Node rawNode(Value value, const Mark startMark, const Tag tag,
const ScalarStyle scalarStyle,
const CollectionStyle collectionStyle) @safe
const CollectionStyle collectionStyle) @trusted
{
Node node;
node.value_ = value;
Expand All @@ -1424,7 +1424,7 @@ struct Node
}

// Construct Node.Value from a type it can store directly (after casting if needed)
static Value value(T)(T value) @safe nothrow if(allowed!T)
static Value value(T)(T value) @system nothrow if(allowed!T)
{
static if(Value.allowed!T)
{
Expand Down Expand Up @@ -1686,7 +1686,7 @@ struct Node
}

// Implementation of contains() and containsKey().
bool contains_(T, Flag!"key" key, string func)(T rhs) const @safe
bool contains_(T, Flag!"key" key, string func)(T rhs) const @trusted
{
static if(!key) if(isSequence)
{
Expand Down Expand Up @@ -1751,7 +1751,7 @@ struct Node
}

// Get index of pair with key (or value, if key is false) matching index.
sizediff_t findPair(T, Flag!"key" key = Yes.key)(const ref T index) const @safe
sizediff_t findPair(T, Flag!"key" key = Yes.key)(const ref T index) const @trusted
{
const pairs = value_.get!(const Pair[])();
const(Node)* node;
Expand Down Expand Up @@ -1792,7 +1792,7 @@ struct Node
}

// Const version of opIndex.
ref const(Node) indexConst(T)(T index) const @safe
ref const(Node) indexConst(T)(T index) const @trusted
{
if(isSequence)
{
Expand Down
2 changes: 1 addition & 1 deletion source/dyaml/representer.d
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ final class Representer
* --------------------
*/
Node representScalar(string tag, string scalar,
ScalarStyle style = ScalarStyle.Invalid) @safe
ScalarStyle style = ScalarStyle.Invalid) @trusted
{
if(style == ScalarStyle.Invalid){style = defaultScalarStyle_;}
return Node.rawNode(Node.Value(scalar), Mark(), Tag(tag), style,
Expand Down

0 comments on commit 2f3d782

Please sign in to comment.