Compare commits

..

2 Commits

Author SHA1 Message Date
Oliver Booth 6743918f44
fix: slice from initial index 2023-08-08 22:25:23 +01:00
Oliver Booth 030e5fdd3d
perf: inline redundant var 2023-08-08 22:25:06 +01:00
1 changed files with 6 additions and 5 deletions

View File

@ -76,8 +76,7 @@ public sealed class TemplateInlineParser : InlineParser
ReadOnlySpan<char> result = ReadNext(argumentSpan, ref index, false, out bool hasValue);
if (!hasValue)
{
var argument = result.ToString();
argumentList.Add(argument);
argumentList.Add(result.ToString());
continue;
}
@ -105,6 +104,8 @@ public sealed class TemplateInlineParser : InlineParser
out bool hasValue)
{
var isEscaped = false;
int startIndex = index;
for (; index < argumentSpan.Length; index++)
{
char currentChar = argumentSpan[index];
@ -120,16 +121,16 @@ public sealed class TemplateInlineParser : InlineParser
case '|' when !isEscaped:
hasValue = false;
return argumentSpan[..index];
return argumentSpan[startIndex..index];
case '=' when !isEscaped && !consumeToken:
hasValue = true;
return argumentSpan[..index];
return argumentSpan[startIndex..index];
}
}
hasValue = false;
return argumentSpan[..index];
return argumentSpan[startIndex..index];
}
private static ReadOnlySpan<char> ReadUntilClosure(ReadOnlySpan<char> input)