Merge pull request #162 from Herringway/alias-cleanup

clean up aliases
merged-on-behalf-of: BBasile <BBasile@users.noreply.github.com>
This commit is contained in:
The Dlang Bot 2018-06-13 10:44:29 +02:00 committed by GitHub
commit 7a2018538c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 24 additions and 42 deletions

View file

@ -769,14 +769,12 @@ Node.Pair[] constructOrderedMap(ref Node node) @safe
}
@safe unittest
{
alias Node.Pair Pair;
Node[] alternateTypes(uint length) @safe
{
Node[] pairs;
foreach(long i; 0 .. length)
{
auto pair = (i % 2) ? Pair(i.to!string, i) : Pair(i, i.to!string);
auto pair = (i % 2) ? Node.Pair(i.to!string, i) : Node.Pair(i, i.to!string);
pairs ~= Node([pair]);
}
return pairs;
@ -787,7 +785,7 @@ Node.Pair[] constructOrderedMap(ref Node node) @safe
Node[] pairs;
foreach(long i; 0 .. length)
{
auto pair = Pair(i.to!string, i);
auto pair = Node.Pair(i.to!string, i);
pairs ~= Node([pair]);
}
return pairs;

View file

@ -72,8 +72,6 @@ private alias isSpace = among!('\0', '\n', '\r', '\u0085', '\u2028', '\u2029', '
struct Emitter
{
private:
alias dyaml.tagdirective.TagDirective TagDirective;
///Default tag handle shortcuts and replacements.
static TagDirective[] defaultTagDirectives_ =
[TagDirective("!", "!"), TagDirective("!!", "tag:yaml.org,2002:")];

View file

@ -13,8 +13,6 @@ import std.array;
import std.string;
import std.conv;
alias to!string str;
/// Base class for all exceptions thrown by D:YAML.
class YAMLException : Exception
@ -53,7 +51,7 @@ struct Mark
// Line/column numbers start at zero internally, make them start at 1.
static string clamped(ushort v) @safe pure nothrow
{
return str(v + 1) ~ (v == ushort.max ? " or higher" : "");
return text(v + 1, v == ushort.max ? " or higher" : "");
}
return "line " ~ clamped(line_) ~ ",column " ~ clamped(column_);
}

View file

@ -165,8 +165,8 @@ struct Node
package:
// YAML value type.
alias Algebraic!(YAMLNull, YAMLMerge, bool, long, real, ubyte[], SysTime, string,
Node.Pair[], Node[], YAMLObject) Value;
alias Value = Algebraic!(YAMLNull, YAMLMerge, bool, long, real, ubyte[], SysTime, string,
Node.Pair[], Node[], YAMLObject);
// Can Value hold this type without wrapping it in a YAMLObject?
enum allowed(T) = isIntegral!T ||
@ -522,7 +522,7 @@ struct Node
}
/// Shortcut for get().
alias get as;
alias as = get;
/** Get the value of the node as specified type.
*
@ -722,9 +722,6 @@ struct Node
///
@safe unittest
{
alias Node.Value Value;
alias Node.Pair Pair;
Node narray = Node([11, 12, 13, 14]);
Node nmap = Node(["11", "12", "13", "14"], [11, 12, 13, 14]);
@ -735,9 +732,6 @@ struct Node
}
@safe unittest
{
alias Node.Value Value;
alias Node.Pair Pair;
Node narray = Node([11, 12, 13, 14]);
Node nmap = Node(["11", "12", "13", "14"], [11, 12, 13, 14]);
@ -1432,9 +1426,6 @@ struct Node
}
@safe unittest
{
alias Node.Value Value;
alias Node.Pair Pair;
Node n1 = Node(cast(long)11);
Node n2 = Node(cast(long)12);
Node n3 = Node(cast(long)13);
@ -1954,22 +1945,22 @@ struct Node
}
// Is the value a bool?
alias isType!bool isBool;
alias isBool = isType!bool;
// Is the value a raw binary buffer?
alias isType!(ubyte[]) isBinary;
alias isBinary = isType!(ubyte[]);
// Is the value an integer?
alias isType!long isInt;
alias isInt = isType!long;
// Is the value a floating point number?
alias isType!real isFloat;
alias isFloat = isType!real;
// Is the value a string?
alias isType!string isString;
alias isString = isType!string;
// Is the value a timestamp?
alias isType!SysTime isTime;
alias isTime = isType!SysTime;
// Does given node have the same type as this node?
bool hasEqualType(const ref Node node) const @safe

View file

@ -104,7 +104,7 @@ enum TestStatus
}
///Unittest result.
alias Tuple!(string, "name", string[], "filenames", TestStatus, "kind", string, "info") Result;
alias Result = Tuple!(string, "name", string[], "filenames", TestStatus, "kind", string, "info");
/**
* Find unittest input filenames.

View file

@ -17,9 +17,6 @@ import std.system;
import dyaml.test.common;
import dyaml.stream;
alias std.system.endian endian;
/// Get an UTF-16 byte order mark.
///
/// Params: wrong = Get the incorrect BOM for this system.

View file

@ -132,14 +132,14 @@ Token streamStartToken(const Mark start, const Mark end, const Encoding encoding
}
/// Aliases for construction of simple token types.
alias simpleToken!(TokenID.StreamEnd) streamEndToken;
alias simpleToken!(TokenID.BlockSequenceStart) blockSequenceStartToken;
alias simpleToken!(TokenID.BlockMappingStart) blockMappingStartToken;
alias simpleToken!(TokenID.BlockEnd) blockEndToken;
alias simpleToken!(TokenID.Key) keyToken;
alias simpleToken!(TokenID.Value) valueToken;
alias simpleToken!(TokenID.BlockEntry) blockEntryToken;
alias simpleToken!(TokenID.FlowEntry) flowEntryToken;
alias streamEndToken = simpleToken!(TokenID.StreamEnd);
alias blockSequenceStartToken = simpleToken!(TokenID.BlockSequenceStart);
alias blockMappingStartToken = simpleToken!(TokenID.BlockMappingStart);
alias blockEndToken = simpleToken!(TokenID.BlockEnd);
alias keyToken = simpleToken!(TokenID.Key);
alias valueToken = simpleToken!(TokenID.Value);
alias blockEntryToken = simpleToken!(TokenID.BlockEntry);
alias flowEntryToken = simpleToken!(TokenID.FlowEntry);
/// Construct a simple token with value with specified type.
///
@ -157,9 +157,9 @@ Token simpleValueToken(TokenID id)(const Mark start, const Mark end, char[] valu
}
/// Alias for construction of tag token.
alias simpleValueToken!(TokenID.Tag) tagToken;
alias simpleValueToken!(TokenID.Alias) aliasToken;
alias simpleValueToken!(TokenID.Anchor) anchorToken;
alias tagToken = simpleValueToken!(TokenID.Tag);
alias aliasToken = simpleValueToken!(TokenID.Alias);
alias anchorToken = simpleValueToken!(TokenID.Anchor);
/// Construct a scalar token.
///