Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
4ef7c3d7
R
roslyn
项目概览
lwm1986
/
roslyn
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
roslyn
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
4ef7c3d7
编写于
3月 23, 2017
作者:
C
CyrusNajmabadi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Simplify naming.
上级
25a7a6d2
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
10 addition
and
10 deletion
+10
-10
src/Workspaces/Core/Portable/PatternMatching/PatternMatcher.cs
...orkspaces/Core/Portable/PatternMatching/PatternMatcher.cs
+10
-10
未找到文件。
src/Workspaces/Core/Portable/PatternMatching/PatternMatcher.cs
浏览文件 @
4ef7c3d7
...
@@ -617,12 +617,12 @@ private bool PartStartsWith(string candidate, TextSpan candidatePart, string pat
...
@@ -617,12 +617,12 @@ private bool PartStartsWith(string candidate, TextSpan candidatePart, string pat
string
candidate
,
string
candidate
,
bool
includeMatchedSpans
,
bool
includeMatchedSpans
,
StringBreaks
candidateParts
,
StringBreaks
candidateParts
,
TextChunk
c
hunk
,
TextChunk
patternC
hunk
,
CompareOptions
compareOption
,
CompareOptions
compareOption
,
out
List
<
TextSpan
>
matchedSpans
)
out
List
<
TextSpan
>
matchedSpans
)
{
{
matchedSpans
=
null
;
matchedSpans
=
null
;
var
chunkCharacterSpans
=
c
hunk
.
CharacterSpans
;
var
patternChunkCharacterSpans
=
patternC
hunk
.
CharacterSpans
;
// Note: we may have more pattern parts than candidate parts. This is because multiple
// 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".
// 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
...
@@ -637,7 +637,7 @@ private bool PartStartsWith(string candidate, TextSpan candidatePart, string pat
while
(
true
)
while
(
true
)
{
{
// Let's consider our termination cases
// Let's consider our termination cases
if
(
currentChunkSpan
==
c
hunkCharacterSpans
.
Count
)
if
(
currentChunkSpan
==
patternC
hunkCharacterSpans
.
Count
)
{
{
Contract
.
Requires
(
firstMatch
.
HasValue
);
Contract
.
Requires
(
firstMatch
.
HasValue
);
Contract
.
Requires
(
contiguous
.
HasValue
);
Contract
.
Requires
(
contiguous
.
HasValue
);
...
@@ -673,23 +673,23 @@ private bool PartStartsWith(string candidate, TextSpan candidatePart, string pat
...
@@ -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'
// 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
// against 'Simple' first. Then we'll match 'U' against 'UI'. However, we want to
// still keep matching pattern parts against that candidate part.
// still keep matching pattern parts against that candidate part.
for
(;
currentChunkSpan
<
c
hunkCharacterSpans
.
Count
;
currentChunkSpan
++)
for
(;
currentChunkSpan
<
patternC
hunkCharacterSpans
.
Count
;
currentChunkSpan
++)
{
{
var
chunkCharacterSpan
=
c
hunkCharacterSpans
[
currentChunkSpan
];
var
patternChunkCharacterSpan
=
patternC
hunkCharacterSpans
[
currentChunkSpan
];
if
(
gotOneMatchThisCandidate
)
if
(
gotOneMatchThisCandidate
)
{
{
// We've already gotten one pattern part match in this candidate. We will
// 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
// only continue trying to consume pattern parts if the last part and this
// part are both upper case.
// part are both upper case.
if
(!
char
.
IsUpper
(
chunk
.
Text
[
c
hunkCharacterSpans
[
currentChunkSpan
-
1
].
Start
])
||
if
(!
char
.
IsUpper
(
patternChunk
.
Text
[
patternC
hunkCharacterSpans
[
currentChunkSpan
-
1
].
Start
])
||
!
char
.
IsUpper
(
chunk
.
Text
[
c
hunkCharacterSpans
[
currentChunkSpan
].
Start
]))
!
char
.
IsUpper
(
patternChunk
.
Text
[
patternC
hunkCharacterSpans
[
currentChunkSpan
].
Start
]))
{
{
break
;
break
;
}
}
}
}
if
(!
PartStartsWith
(
candidate
,
candidatePart
,
chunk
.
Text
,
c
hunkCharacterSpan
,
compareOption
))
if
(!
PartStartsWith
(
candidate
,
candidatePart
,
patternChunk
.
Text
,
patternC
hunkCharacterSpan
,
compareOption
))
{
{
break
;
break
;
}
}
...
@@ -697,7 +697,7 @@ private bool PartStartsWith(string candidate, TextSpan candidatePart, string pat
...
@@ -697,7 +697,7 @@ private bool PartStartsWith(string candidate, TextSpan candidatePart, string pat
if
(
includeMatchedSpans
)
if
(
includeMatchedSpans
)
{
{
matchedSpans
=
matchedSpans
??
new
List
<
TextSpan
>();
matchedSpans
=
matchedSpans
??
new
List
<
TextSpan
>();
matchedSpans
.
Add
(
new
TextSpan
(
candidatePart
.
Start
,
c
hunkCharacterSpan
.
Length
));
matchedSpans
.
Add
(
new
TextSpan
(
candidatePart
.
Start
,
patternC
hunkCharacterSpan
.
Length
));
}
}
gotOneMatchThisCandidate
=
true
;
gotOneMatchThisCandidate
=
true
;
...
@@ -709,7 +709,7 @@ private bool PartStartsWith(string candidate, TextSpan candidatePart, string pat
...
@@ -709,7 +709,7 @@ private bool PartStartsWith(string candidate, TextSpan candidatePart, string pat
// obviously contiguous.
// obviously contiguous.
contiguous
=
contiguous
??
true
;
contiguous
=
contiguous
??
true
;
candidatePart
=
new
TextSpan
(
candidatePart
.
Start
+
chunkCharacterSpan
.
Length
,
candidatePart
.
Length
-
c
hunkCharacterSpan
.
Length
);
candidatePart
=
new
TextSpan
(
candidatePart
.
Start
+
patternChunkCharacterSpan
.
Length
,
candidatePart
.
Length
-
patternC
hunkCharacterSpan
.
Length
);
}
}
// Check if we matched anything at all. If we didn't, then we need to unset the
// 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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录