From f11fbf3b36548328fbc27128d709bc9cc722120a Mon Sep 17 00:00:00 2001 From: Ferdinand Majerech Date: Sat, 26 Jul 2014 18:19:26 +0200 Subject: [PATCH] scanTagDirectiveValue returns handle length with return value, not ref param --- source/dyaml/scanner.d | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/source/dyaml/scanner.d b/source/dyaml/scanner.d index 690e07e..7f4cd0c 100644 --- a/source/dyaml/scanner.d +++ b/source/dyaml/scanner.d @@ -949,7 +949,7 @@ final class Scanner // Index where tag handle ends and suffix starts in a tag directive value. uint tagHandleEnd = uint.max; if(name == "YAML"d) { scanYAMLDirectiveValueToSlice(startMark); } - else if(name == "TAG"d) { scanTagDirectiveValueToSlice(startMark, tagHandleEnd); } + else if(name == "TAG"d) { tagHandleEnd = scanTagDirectiveValueToSlice(startMark); } throwIfError(); const value = reader_.sliceBuilder.finish(); @@ -1051,17 +1051,21 @@ final class Scanner /// Assumes that the caller is building a slice in Reader, and puts the scanned /// characters into that slice. /// + /// Returns: Length of tag handle (which is before tag prefix) in scanned data + /// /// In case of an error, error_ is set. Use throwIfError() to handle this. - void scanTagDirectiveValueToSlice(const Mark startMark, ref uint handleLength) + uint scanTagDirectiveValueToSlice(const Mark startMark) @system pure nothrow { findNextNonSpace(); const startLength = reader_.sliceBuilder.length; scanTagDirectiveHandleToSlice(startMark); - if(error_) { return; } - handleLength = cast(uint)(reader_.sliceBuilder.length - startLength); + if(error_) { return uint.max; } + const handleLength = cast(uint)(reader_.sliceBuilder.length - startLength); findNextNonSpace(); scanTagDirectivePrefixToSlice(startMark); + + return handleLength; } /// Scan handle of a tag directive.