Merge pull request #118 from Herringway/safer-composer

make Composer fully @safe to use
merged-on-behalf-of: BBasile <BBasile@users.noreply.github.com>
This commit is contained in:
The Dlang Bot 2018-04-23 00:24:58 +02:00 committed by GitHub
commit 205f04a67f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -116,7 +116,7 @@ final class Composer
} }
///Get single YAML document, throwing if there is more than one document. ///Get single YAML document, throwing if there is more than one document.
Node getSingleNode() @trusted Node getSingleNode() @safe
{ {
assert(!parser_.checkEvent(EventID.StreamEnd), assert(!parser_.checkEvent(EventID.StreamEnd),
"Trying to get a node from Composer when there is no node to " ~ "Trying to get a node from Composer when there is no node to " ~
@ -142,7 +142,7 @@ final class Composer
///Params: pairAppenderLevel = Current level in the pair appender stack. ///Params: pairAppenderLevel = Current level in the pair appender stack.
/// nodeAppenderLevel = Current level the node appender stack. /// nodeAppenderLevel = Current level the node appender stack.
void ensureAppendersExist(const uint pairAppenderLevel, const uint nodeAppenderLevel) void ensureAppendersExist(const uint pairAppenderLevel, const uint nodeAppenderLevel)
@trusted @safe
{ {
while(pairAppenders_.length <= pairAppenderLevel) while(pairAppenders_.length <= pairAppenderLevel)
{ {
@ -155,7 +155,7 @@ final class Composer
} }
///Compose a YAML document and return its root node. ///Compose a YAML document and return its root node.
Node composeDocument() @trusted Node composeDocument() @safe
{ {
//Drop the DOCUMENT-START event. //Drop the DOCUMENT-START event.
parser_.getEvent(); parser_.getEvent();