提交 4ef7c3d7 编写于 作者: C CyrusNajmabadi

Simplify naming.

上级 25a7a6d2
......@@ -617,12 +617,12 @@ private bool PartStartsWith(string candidate, TextSpan candidatePart, string pat
string candidate,
bool includeMatchedSpans,
StringBreaks candidateParts,
TextChunk chunk,
TextChunk patternChunk,
CompareOptions compareOption,
out List<TextSpan> matchedSpans)
{
matchedSpans = null;
var chunkCharacterSpans = chunk.CharacterSpans;
var patternChunkCharacterSpans = patternChunk.CharacterSpans;
// Note: we may have more pattern parts than candidate parts. This is because multiple
// pattern parts may match a candidate part. For example "SiUI" against "SimpleUI".
......@@ -637,7 +637,7 @@ private bool PartStartsWith(string candidate, TextSpan candidatePart, string pat
while (true)
{
// Let's consider our termination cases
if (currentChunkSpan == chunkCharacterSpans.Count)
if (currentChunkSpan == patternChunkCharacterSpans.Count)
{
Contract.Requires(firstMatch.HasValue);
Contract.Requires(contiguous.HasValue);
......@@ -673,23 +673,23 @@ private bool PartStartsWith(string candidate, TextSpan candidatePart, string pat
// will be Simple/UI/Element, and the pattern parts will be Si/U/I. We'll match 'Si'
// against 'Simple' first. Then we'll match 'U' against 'UI'. However, we want to
// still keep matching pattern parts against that candidate part.
for (; currentChunkSpan < chunkCharacterSpans.Count; currentChunkSpan++)
for (; currentChunkSpan < patternChunkCharacterSpans.Count; currentChunkSpan++)
{
var chunkCharacterSpan = chunkCharacterSpans[currentChunkSpan];
var patternChunkCharacterSpan = patternChunkCharacterSpans[currentChunkSpan];
if (gotOneMatchThisCandidate)
{
// We've already gotten one pattern part match in this candidate. We will
// only continue trying to consume pattern parts if the last part and this
// part are both upper case.
if (!char.IsUpper(chunk.Text[chunkCharacterSpans[currentChunkSpan - 1].Start]) ||
!char.IsUpper(chunk.Text[chunkCharacterSpans[currentChunkSpan].Start]))
if (!char.IsUpper(patternChunk.Text[patternChunkCharacterSpans[currentChunkSpan - 1].Start]) ||
!char.IsUpper(patternChunk.Text[patternChunkCharacterSpans[currentChunkSpan].Start]))
{
break;
}
}
if (!PartStartsWith(candidate, candidatePart, chunk.Text, chunkCharacterSpan, compareOption))
if (!PartStartsWith(candidate, candidatePart, patternChunk.Text, patternChunkCharacterSpan, compareOption))
{
break;
}
......@@ -697,7 +697,7 @@ private bool PartStartsWith(string candidate, TextSpan candidatePart, string pat
if (includeMatchedSpans)
{
matchedSpans = matchedSpans ?? new List<TextSpan>();
matchedSpans.Add(new TextSpan(candidatePart.Start, chunkCharacterSpan.Length));
matchedSpans.Add(new TextSpan(candidatePart.Start, patternChunkCharacterSpan.Length));
}
gotOneMatchThisCandidate = true;
......@@ -709,7 +709,7 @@ private bool PartStartsWith(string candidate, TextSpan candidatePart, string pat
// obviously contiguous.
contiguous = contiguous ?? true;
candidatePart = new TextSpan(candidatePart.Start + chunkCharacterSpan.Length, candidatePart.Length - chunkCharacterSpan.Length);
candidatePart = new TextSpan(candidatePart.Start + patternChunkCharacterSpan.Length, candidatePart.Length - patternChunkCharacterSpan.Length);
}
// Check if we matched anything at all. If we didn't, then we need to unset the
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册