Merge pull request #150 from Herringway/safe-opapply
add Loader.opApply overload for @safe delegates
This commit is contained in:
commit
646315ca4c
|
@ -242,7 +242,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");
|
||||||
|
@ -271,8 +282,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
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue