From 7f53fdfec03b1d7da3f2b166e4103ca64ce444ce Mon Sep 17 00:00:00 2001 From: Mathias Lang Date: Tue, 24 May 2016 00:07:07 +0200 Subject: [PATCH] Do not rely on the result of a comma expression Also add `pragma(inline, true)` to ensure this function stays inlined. --- std/regex/internal/ir.d | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/std/regex/internal/ir.d b/std/regex/internal/ir.d index a971ef0c0..b5e13e596 100644 --- a/std/regex/internal/ir.d +++ b/std/regex/internal/ir.d @@ -606,15 +606,15 @@ struct Input(Char) } //codepoint at current stream position - bool nextChar(ref dchar res, ref size_t pos) + pragma(inline, true) bool nextChar(ref dchar res, ref size_t pos) { pos = _index; // DMD's inliner hates multiple return functions // but can live with single statement if/else bodies - if (_index == _origin.length) - return false; - else - return res = std.utf.decode(_origin, _index), true; + bool n = !(_index == _origin.length); + if (n) + res = std.utf.decode(_origin, _index); + return n; } @property bool atEnd(){ return _index == _origin.length;