提交 85bf9a36 编写于 作者: C CyrusNajmabadi

Avoid text span indirection.

上级 dcd5ed21
...@@ -275,13 +275,14 @@ private static TextSpan ScanWordRun(string identifier, int length, int wordStart ...@@ -275,13 +275,14 @@ private static TextSpan ScanWordRun(string identifier, int length, int wordStart
{ {
// hit the 'o' in XMLDo. Return "XML" // hit the 'o' in XMLDo. Return "XML"
Debug.Assert(char.IsUpper(identifier[current - 1])); Debug.Assert(char.IsUpper(identifier[current - 1]));
return TextSpan.FromBounds(wordStart, current - 1); var end = current - 1;
return new TextSpan(wordStart, end - wordStart);
} }
else else
{ {
// Hit something else (punctuation, end of string, etc.) // Hit something else (punctuation, end of string, etc.)
// return the entire upper-case section. // return the entire upper-case section.
return TextSpan.FromBounds(wordStart, current); return new TextSpan(wordStart, current - wordStart);
} }
} }
else if (IsLower(c)) else if (IsLower(c))
...@@ -305,7 +306,7 @@ private static TextSpan ScanLowerCaseRun(string identifier, int length, int word ...@@ -305,7 +306,7 @@ private static TextSpan ScanLowerCaseRun(string identifier, int length, int word
current++; current++;
} }
return TextSpan.FromBounds(wordStart, current); return new TextSpan(wordStart, current - wordStart);
} }
private static TextSpan ScanNumber(string identifier, int length, int wordStart) private static TextSpan ScanNumber(string identifier, int length, int wordStart)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册