add Loader.opApply overload for @safe delegates

This commit is contained in:
Cameron Ross 2018-06-10 12:22:26 -03:00
parent 5757869e9a
commit 799a27a99f
No known key found for this signature in database
GPG key ID: 777897D98DC91C54

View file

@ -233,7 +233,18 @@ struct Loader
* *
* Throws: YAMLException on a parsing error. * Throws: YAMLException on a parsing error.
*/ */
int opApply(int delegate(ref Node) dg) @trusted int opApply(int delegate(ref Node) @safe dg) @safe
{
return opApplyImpl(dg);
}
/// Ditto
int opApply(int delegate(ref Node) @system dg) @system
{
return opApplyImpl(dg);
}
package:
int opApplyImpl(T)(T dg)
in in
{ {
assert(!done_, "Loader: Trying to load YAML twice"); assert(!done_, "Loader: Trying to load YAML twice");
@ -262,8 +273,6 @@ struct Loader
.format(name_, e.msg)); .format(name_, e.msg));
} }
} }
package:
// Scan and return all tokens. Used for debugging. // Scan and return all tokens. Used for debugging.
Token[] scan() @safe Token[] scan() @safe
{ {