File tree Expand file tree Collapse file tree 1 file changed +5
-12
lines changed
Expand file tree Collapse file tree 1 file changed +5
-12
lines changed Original file line number Diff line number Diff line change @@ -1302,7 +1302,7 @@ private dchar decodeImpl(bool canIndex, UseReplacementDchar useReplacementDchar
13021302 alias bitMask = AliasSeq! ((1 << 7 ) - 1 , (1 << 11 ) - 1 , (1 << 16 ) - 1 , (1 << 21 ) - 1 );
13031303
13041304 static if (is (S : const char []))
1305- auto pstr = str.ptr + index;
1305+ auto pstr = str.ptr + index; // this is what makes decodeImpl() @system code
13061306 else static if (isRandomAccessRange! S && hasSlicing! S && hasLength! S)
13071307 auto pstr = str[index .. str.length];
13081308 else
@@ -3802,17 +3802,12 @@ template byUTF(C) if (isSomeChar!C)
38023802 {
38033803 static struct Result
38043804 {
3805- this (ref R r)
3806- {
3807- this .r = r;
3808- }
3809-
38103805 @property bool empty()
38113806 {
38123807 return pos == fill && r.empty;
38133808 }
38143809
3815- @property auto front()
3810+ @property auto front() scope // 'scope' required by call to decodeFront() below
38163811 {
38173812 if (pos == fill)
38183813 {
@@ -3829,14 +3824,12 @@ template byUTF(C) if (isSomeChar!C)
38293824 {
38303825 static if (is (RC == dchar ))
38313826 {
3832- fill = cast (ushort ) encode! (Yes.useReplacementDchar)(buf, c);
38333827 r.popFront;
3828+ dchar dc = c;
38343829 }
38353830 else
3836- {
3837- fill = cast (ushort ) encode! (Yes.useReplacementDchar)(
3838- buf, decodeFront! (Yes.useReplacementDchar)(r));
3839- }
3831+ dchar dc = () @trusted { return decodeFront! (Yes.useReplacementDchar)(r); }();
3832+ fill = cast (ushort ) encode! (Yes.useReplacementDchar)(buf, dc);
38403833 }
38413834 }
38423835 return buf[pos];
You can’t perform that action at this time.
0 commit comments