Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
a88b006c
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,发现更多精彩内容 >>
提交
a88b006c
编写于
9月 22, 2016
作者:
J
Jason Malinowski
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'dotnet/dev15-preview-5' into master
上级
c45b994d
b38ee703
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
37 addition
and
23 deletion
+37
-23
src/Compilers/CSharp/Portable/BoundTree/DecisionTree.cs
src/Compilers/CSharp/Portable/BoundTree/DecisionTree.cs
+13
-13
src/EditorFeatures/Core/Implementation/FindReferences/AbstractFindReferencesService.cs
...mentation/FindReferences/AbstractFindReferencesService.cs
+24
-10
未找到文件。
src/Compilers/CSharp/Portable/BoundTree/DecisionTree.cs
浏览文件 @
a88b006c
...
...
@@ -224,7 +224,7 @@ private void AddToDecisionTree(DecisionTree decisionTree, BoundPatternSwitchLabe
case
BoundKind
.
ConstantPattern
:
{
var
constantPattern
=
(
BoundConstantPattern
)
pattern
;
AddByValue
(
decisionTree
,
constantPattern
.
Value
,
(
e
,
t
)
=>
new
DecisionTree
.
Guarded
(
e
,
t
,
default
(
ImmutableArray
<
KeyValuePair
<
BoundExpression
,
LocalSymbol
>>),
_section
,
guard
,
label
)
,
label
.
HasErrors
);
AddByValue
(
decisionTree
,
constantPattern
.
Value
,
(
e
,
t
)
=>
new
DecisionTree
.
Guarded
(
e
,
t
,
default
(
ImmutableArray
<
KeyValuePair
<
BoundExpression
,
LocalSymbol
>>),
_section
,
guard
,
label
));
break
;
}
case
BoundKind
.
DeclarationPattern
:
...
...
@@ -475,7 +475,7 @@ private ErrorCode CheckSubsumed(BoundPattern pattern, DecisionTree decisionTree,
BoundExpression
expression
,
TypeSymbol
type
);
private
DecisionTree
AddByValue
(
DecisionTree
decision
,
BoundExpression
value
,
DecisionMaker
makeDecision
,
bool
hasErrors
)
private
DecisionTree
AddByValue
(
DecisionTree
decision
,
BoundExpression
value
,
DecisionMaker
makeDecision
)
{
if
(
decision
.
MatchIsComplete
)
{
...
...
@@ -487,17 +487,17 @@ private DecisionTree AddByValue(DecisionTree decision, BoundExpression value, De
switch
(
decision
.
Kind
)
{
case
DecisionTree
.
DecisionKind
.
ByType
:
return
AddByValue
((
DecisionTree
.
ByType
)
decision
,
value
,
makeDecision
,
hasErrors
);
return
AddByValue
((
DecisionTree
.
ByType
)
decision
,
value
,
makeDecision
);
case
DecisionTree
.
DecisionKind
.
ByValue
:
return
AddByValue
((
DecisionTree
.
ByValue
)
decision
,
value
,
makeDecision
,
hasErrors
);
return
AddByValue
((
DecisionTree
.
ByValue
)
decision
,
value
,
makeDecision
);
case
DecisionTree
.
DecisionKind
.
Guarded
:
return
AddByValue
((
DecisionTree
.
Guarded
)
decision
,
value
,
makeDecision
,
hasErrors
);
return
AddByValue
((
DecisionTree
.
Guarded
)
decision
,
value
,
makeDecision
);
default
:
throw
ExceptionUtilities
.
UnexpectedValue
(
decision
.
Kind
);
}
}
private
DecisionTree
AddByValue
(
DecisionTree
.
Guarded
guarded
,
BoundExpression
value
,
DecisionMaker
makeDecision
,
bool
hasErrors
)
private
DecisionTree
AddByValue
(
DecisionTree
.
Guarded
guarded
,
BoundExpression
value
,
DecisionMaker
makeDecision
)
{
if
(
guarded
.
Default
!=
null
)
{
...
...
@@ -511,20 +511,20 @@ private DecisionTree AddByValue(DecisionTree.Guarded guarded, BoundExpression va
guarded
.
Default
=
new
DecisionTree
.
ByValue
(
guarded
.
Expression
,
guarded
.
Type
,
null
);
}
return
AddByValue
(
guarded
.
Default
,
value
,
makeDecision
,
hasErrors
);
return
AddByValue
(
guarded
.
Default
,
value
,
makeDecision
);
}
private
DecisionTree
AddByValue
(
DecisionTree
.
ByValue
byValue
,
BoundExpression
value
,
DecisionMaker
makeDecision
,
bool
hasErrors
)
private
DecisionTree
AddByValue
(
DecisionTree
.
ByValue
byValue
,
BoundExpression
value
,
DecisionMaker
makeDecision
)
{
Debug
.
Assert
(
value
.
Type
==
byValue
.
Type
);
if
(
byValue
.
Default
!=
null
)
{
return
AddByValue
(
byValue
.
Default
,
value
,
makeDecision
,
hasErrors
);
return
AddByValue
(
byValue
.
Default
,
value
,
makeDecision
);
}
// For error recovery, to avoid "unreachable code" diagnostics when there is a bad case
// label, we use the case label itself as the value key.
object
valueKey
=
hasErrors
?
(
object
)
value
:
value
.
ConstantValue
.
V
alue
;
object
valueKey
=
value
.
ConstantValue
?.
Value
??
v
alue
;
DecisionTree
valueDecision
;
if
(
byValue
.
ValueAndDecision
.
TryGetValue
(
valueKey
,
out
valueDecision
))
{
...
...
@@ -546,13 +546,13 @@ private DecisionTree AddByValue(DecisionTree.ByValue byValue, BoundExpression va
return
valueDecision
;
}
private
DecisionTree
AddByValue
(
DecisionTree
.
ByType
byType
,
BoundExpression
value
,
DecisionMaker
makeDecision
,
bool
hasErrors
)
private
DecisionTree
AddByValue
(
DecisionTree
.
ByType
byType
,
BoundExpression
value
,
DecisionMaker
makeDecision
)
{
if
(
byType
.
Default
!=
null
)
{
try
{
return
AddByValue
(
byType
.
Default
,
value
,
makeDecision
,
hasErrors
);
return
AddByValue
(
byType
.
Default
,
value
,
makeDecision
);
}
finally
{
...
...
@@ -619,7 +619,7 @@ private DecisionTree AddByValue(DecisionTree.ByType byType, BoundExpression valu
byType
.
TypeAndDecision
.
Add
(
new
KeyValuePair
<
TypeSymbol
,
DecisionTree
>(
value
.
Type
,
forType
));
}
return
AddByValue
(
forType
,
value
,
makeDecision
,
hasErrors
);
return
AddByValue
(
forType
,
value
,
makeDecision
);
}
private
DecisionTree
AddByType
(
DecisionTree
decision
,
TypeSymbol
type
,
DecisionMaker
makeDecision
)
...
...
src/EditorFeatures/Core/Implementation/FindReferences/AbstractFindReferencesService.cs
浏览文件 @
a88b006c
...
...
@@ -193,6 +193,26 @@ private bool TryDisplayReferences(Tuple<IEnumerable<ReferencedSymbol>, Solution>
public
async
Task
FindReferencesAsync
(
Document
document
,
int
position
,
FindReferencesContext
context
)
{
// NOTE: All ConFigureAwaits in this method need to pass 'true' so that
// we return to the caller's context. that's so the call to
// CallThirdPartyExtensionsAsync will happen on the UI thread. We need
// this to maintain the threading guarantee we had around that method
// from pre-Roslyn days.
var
findReferencesProgress
=
await
FindReferencesWorkerAsync
(
document
,
position
,
context
).
ConfigureAwait
(
true
);
if
(
findReferencesProgress
==
null
)
{
return
;
}
// After the FAR engine is done call into any third party extensions to see
// if they want to add results.
await
findReferencesProgress
.
CallThirdPartyExtensionsAsync
().
ConfigureAwait
(
true
);
}
private
async
Task
<
ProgressAdapter
>
FindReferencesWorkerAsync
(
Document
document
,
int
position
,
FindReferencesContext
context
)
{
var
cancellationToken
=
context
.
CancellationToken
;
cancellationToken
.
ThrowIfCancellationRequested
();
...
...
@@ -202,7 +222,7 @@ private bool TryDisplayReferences(Tuple<IEnumerable<ReferencedSymbol>, Solution>
document
,
position
,
cancellationToken
).
ConfigureAwait
(
false
);
if
(
symbolAndProject
==
null
)
{
return
;
return
null
;
}
var
symbol
=
symbolAndProject
.
Item1
;
...
...
@@ -217,20 +237,14 @@ private bool TryDisplayReferences(Tuple<IEnumerable<ReferencedSymbol>, Solution>
// engine will push results into the 'progress' instance passed into it.
// We'll take those results, massage them, and forward them along to the
// FindReferencesContext instance we were given.
//
// Note: we pass along ConfigureAwait(true) because we need to come back
// to the UI thread. There's more work we need to do once the FAR engine
// is done.
await
SymbolFinder
.
FindReferencesAsync
(
SymbolAndProjectId
.
Create
(
symbol
,
project
.
Id
),
project
.
Solution
,
progressAdapter
,
documents
:
null
,
cancellationToken
:
cancellationToken
).
ConfigureAwait
(
tru
e
);
cancellationToken
:
cancellationToken
).
ConfigureAwait
(
fals
e
);
// After the FAR engine is done call into any third party extensions to see
// if they want to add results.
await
progressAdapter
.
CallThirdPartyExtensionsAsync
().
ConfigureAwait
(
true
);
return
progressAdapter
;
}
}
}
\ No newline at end of file
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录