diff options
Diffstat (limited to 'src/ext_depends/D-YAML/source/dyaml/exception.d')
-rw-r--r-- | src/ext_depends/D-YAML/source/dyaml/exception.d | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/ext_depends/D-YAML/source/dyaml/exception.d b/src/ext_depends/D-YAML/source/dyaml/exception.d index 15e9c61..145e9c3 100644 --- a/src/ext_depends/D-YAML/source/dyaml/exception.d +++ b/src/ext_depends/D-YAML/source/dyaml/exception.d @@ -19,7 +19,7 @@ class YAMLException : Exception { /// Construct a YAMLException with specified message and position where it was thrown. public this(string msg, string file = __FILE__, size_t line = __LINE__) - @safe pure nothrow + @safe pure nothrow @nogc { super(msg, file, line); } @@ -65,8 +65,14 @@ struct Mark return column_; } + /// Duplicate a mark + Mark dup () const scope @safe pure nothrow + { + return Mark(this.name_.idup, this.line_, this.column_); + } + /// Get a string representation of the mark. - string toString() @safe pure nothrow const + string toString() const scope @safe pure nothrow { // Line/column numbers start at zero internally, make them start at 1. static string clamped(ushort v) @safe pure nothrow @@ -84,23 +90,24 @@ abstract class MarkedYAMLException : YAMLException Mark mark; // Construct a MarkedYAMLException with specified context and problem. - this(string context, const Mark contextMark, string problem, const Mark problemMark, + this(string context, scope const Mark contextMark, + string problem, scope const Mark problemMark, string file = __FILE__, size_t line = __LINE__) @safe pure nothrow { const msg = context ~ '\n' ~ (contextMark != problemMark ? contextMark.toString() ~ '\n' : "") ~ problem ~ '\n' ~ problemMark.toString() ~ '\n'; super(msg, file, line); - mark = problemMark; + mark = problemMark.dup; } // Construct a MarkedYAMLException with specified problem. - this(string problem, const Mark problemMark, + this(string problem, scope const Mark problemMark, string file = __FILE__, size_t line = __LINE__) @safe pure nothrow { super(problem ~ '\n' ~ problemMark.toString(), file, line); - mark = problemMark; + mark = problemMark.dup; } /// Construct a MarkedYAMLException from a struct storing constructor parameters. |