Merge pull request #150 from Herringway/safe-opapply

add Loader.opApply overload for @safe delegates
This commit is contained in:
BBasile 2018-06-20 21:07:03 +02:00 committed by GitHub
commit 646315ca4c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -242,7 +242,18 @@ struct Loader
*
* 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
{
assert(!done_, "Loader: Trying to load YAML twice");
@ -271,8 +282,6 @@ struct Loader
.format(name_, e.msg));
}
}
package:
// Scan and return all tokens. Used for debugging.
Token[] scan() @safe
{