clean up aliases

This commit is contained in:
Cameron Ross 2018-06-13 05:17:20 -03:00
parent 61f875cbba
commit 1f556fdb70
No known key found for this signature in database
GPG key ID: 777897D98DC91C54
7 changed files with 24 additions and 42 deletions

View file

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

View file

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

View file

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

View file

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

View file

@ -104,7 +104,7 @@ enum TestStatus
} }
///Unittest result. ///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. * Find unittest input filenames.

View file

@ -17,9 +17,6 @@ import std.system;
import dyaml.test.common; import dyaml.test.common;
import dyaml.stream; import dyaml.stream;
alias std.system.endian endian;
/// Get an UTF-16 byte order mark. /// Get an UTF-16 byte order mark.
/// ///
/// Params: wrong = Get the incorrect BOM for this system. /// 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. /// Aliases for construction of simple token types.
alias simpleToken!(TokenID.StreamEnd) streamEndToken; alias streamEndToken = simpleToken!(TokenID.StreamEnd);
alias simpleToken!(TokenID.BlockSequenceStart) blockSequenceStartToken; alias blockSequenceStartToken = simpleToken!(TokenID.BlockSequenceStart);
alias simpleToken!(TokenID.BlockMappingStart) blockMappingStartToken; alias blockMappingStartToken = simpleToken!(TokenID.BlockMappingStart);
alias simpleToken!(TokenID.BlockEnd) blockEndToken; alias blockEndToken = simpleToken!(TokenID.BlockEnd);
alias simpleToken!(TokenID.Key) keyToken; alias keyToken = simpleToken!(TokenID.Key);
alias simpleToken!(TokenID.Value) valueToken; alias valueToken = simpleToken!(TokenID.Value);
alias simpleToken!(TokenID.BlockEntry) blockEntryToken; alias blockEntryToken = simpleToken!(TokenID.BlockEntry);
alias simpleToken!(TokenID.FlowEntry) flowEntryToken; alias flowEntryToken = simpleToken!(TokenID.FlowEntry);
/// Construct a simple token with value with specified type. /// 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 for construction of tag token.
alias simpleValueToken!(TokenID.Tag) tagToken; alias tagToken = simpleValueToken!(TokenID.Tag);
alias simpleValueToken!(TokenID.Alias) aliasToken; alias aliasToken = simpleValueToken!(TokenID.Alias);
alias simpleValueToken!(TokenID.Anchor) anchorToken; alias anchorToken = simpleValueToken!(TokenID.Anchor);
/// Construct a scalar token. /// Construct a scalar token.
/// ///