Compare commits

...

2 Commits

Author SHA1 Message Date
6743918f44
fix: slice from initial index 2023-08-08 22:25:23 +01:00
030e5fdd3d
perf: inline redundant var 2023-08-08 22:25:06 +01:00

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)