Skip to content

Commit

Permalink
Make parseUUID pure
Browse files Browse the repository at this point in the history
  • Loading branch information
monarchdodra committed Nov 22, 2013
1 parent d580aa0 commit b0b72b7
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions std/uuid.d
Original file line number Diff line number Diff line change
Expand Up @@ -1176,11 +1176,8 @@ unittest
* enum ctfeID = parseUUID("8ab3060e-2cba-4f23-b74c-b52db3bdfb46");
* //here parsing is done at compile time, no runtime overhead!
* -------------------------
*
* BUGS: Could be pure, but this depends on parse!(string, 16).
*/

@trusted UUID parseUUID(T)(T uuidString) if(isSomeString!T)
UUID parseUUID(T)(T uuidString) if(isSomeString!T)
{
return parseUUID(uuidString);
}
Expand All @@ -1192,7 +1189,7 @@ UUID parseUUID(Range)(ref Range uuidRange) if(isInputRange!Range
static if(isForwardRange!Range)
auto errorCopy = uuidRange.save;

void parserError(size_t pos, UUIDParsingException.Reason reason, string message, Throwable next = null,
void parserError()(size_t pos, UUIDParsingException.Reason reason, string message, Throwable next = null,
string file = __FILE__, size_t line = __LINE__)
{
static if(isForwardRange!Range)
Expand Down Expand Up @@ -1228,7 +1225,7 @@ UUID parseUUID(Range)(ref Range uuidRange) if(isInputRange!Range
size_t element = 0;

//skip garbage
size_t skip()
size_t skip()()
{
size_t skipped;
while(!uuidRange.empty && !isHexDigit(uuidRange.front))
Expand Down Expand Up @@ -1323,7 +1320,7 @@ UUID parseUUID(Range)(ref Range uuidRange) if(isInputRange!Range
return result;
}

unittest
@safe pure unittest
{
import std.exception;
import std.typetuple;
Expand Down Expand Up @@ -1566,7 +1563,7 @@ public class UUIDParsingException : Exception
size_t position;

private this(string input, size_t pos, Reason why = Reason.unknown, string msg = "",
Throwable next = null, string file = __FILE__, size_t line = __LINE__)
Throwable next = null, string file = __FILE__, size_t line = __LINE__) pure @trusted
{
input = input;
position = pos;
Expand Down

0 comments on commit b0b72b7

Please sign in to comment.