Better function attribs in Mark
This commit is contained in:
parent
405a61891f
commit
9dd6903e13
|
@ -38,17 +38,20 @@ struct Mark
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/// Construct a Mark with specified line and column in the file.
|
/// 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);
|
line_ = cast(ushort)min(ushort.max, line);
|
||||||
column_ = cast(ushort)min(ushort.max, column);
|
column_ = cast(ushort)min(ushort.max, column);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get a string representation of the mark.
|
/// 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.
|
/// 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" : "");}
|
static string clamped(ushort v) @safe pure nothrow
|
||||||
|
{
|
||||||
|
return str(v + 1) ~ (v == ushort.max ? " or higher" : "");
|
||||||
|
}
|
||||||
return "line " ~ clamped(line_) ~ ",column " ~ clamped(column_);
|
return "line " ~ clamped(line_) ~ ",column " ~ clamped(column_);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue