Better function attribs in Mark

This commit is contained in:
Ferdinand Majerech 2014-07-22 01:22:56 +02:00
parent 405a61891f
commit 9dd6903e13

View file

@ -38,17 +38,20 @@ struct Mark
public:
/// Construct a Mark with specified line and column in the file.
this(const uint line, const uint column) pure @safe nothrow
this(const uint line, const uint column) @safe pure nothrow @nogc
{
line_ = cast(ushort)min(ushort.max, line);
column_ = cast(ushort)min(ushort.max, column);
}
/// Get a string representation of the mark.
string toString() const @trusted pure
string toString() @safe pure nothrow const
{
//Line/column numbers start at zero internally, make them start at 1.
string clamped(ushort v){return str(v + 1) ~ (v == ushort.max ? " or higher" : "");}
/// 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 "line " ~ clamped(line_) ~ ",column " ~ clamped(column_);
}
}