Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
b4c9c9e6
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,发现更多精彩内容 >>
提交
b4c9c9e6
编写于
5月 10, 2017
作者:
C
CyrusNajmabadi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add more contract guarantees
上级
9862f360
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
17 addition
and
24 deletion
+17
-24
src/Workspaces/Core/Portable/FindSymbols/SymbolTree/SymbolTreeInfo_Metadata.cs
...ortable/FindSymbols/SymbolTree/SymbolTreeInfo_Metadata.cs
+3
-1
src/Workspaces/Core/Portable/FindSymbols/SymbolTree/SymbolTreeInfo_Serialization.cs
...le/FindSymbols/SymbolTree/SymbolTreeInfo_Serialization.cs
+3
-20
src/Workspaces/Core/Portable/FindSymbols/SymbolTree/SymbolTreeInfo_Source.cs
.../Portable/FindSymbols/SymbolTree/SymbolTreeInfo_Source.cs
+11
-3
未找到文件。
src/Workspaces/Core/Portable/FindSymbols/SymbolTree/SymbolTreeInfo_Metadata.cs
浏览文件 @
b4c9c9e6
...
...
@@ -155,7 +155,7 @@ private static Metadata GetMetadataNoThrow(PortableExecutableReference reference
{
var
filePath
=
reference
.
FilePath
;
return
TryLoadOrCreateAsync
(
var
result
=
TryLoadOrCreateAsync
(
solution
,
checksum
,
filePath
,
...
...
@@ -165,6 +165,8 @@ private static Metadata GetMetadataNoThrow(PortableExecutableReference reference
getPersistedChecksum
:
info
=>
info
.
Checksum
,
readObject
:
reader
=>
ReadSymbolTreeInfo
(
reader
,
(
names
,
nodes
)
=>
GetSpellCheckerTask
(
solution
,
checksum
,
filePath
,
names
,
nodes
)),
cancellationToken
:
cancellationToken
);
Contract
.
ThrowIfFalse
(
result
!=
null
||
loadOnly
==
true
,
"Result can only be null if 'loadOnly: true' was passed."
);
return
result
;
}
private
static
Task
<
SymbolTreeInfo
>
CreateMetadataSymbolTreeInfoAsync
(
...
...
src/Workspaces/Core/Portable/FindSymbols/SymbolTree/SymbolTreeInfo_Serialization.cs
浏览文件 @
b4c9c9e6
...
...
@@ -19,25 +19,6 @@ internal partial class SymbolTreeInfo : IObjectWritable
private
const
string
PrefixMetadataSymbolTreeInfo
=
"<SymbolTreeInfo>"
;
private
const
string
SerializationFormat
=
"17"
;
/// <summary>
/// Loads the SymbolTreeInfo for a given assembly symbol (metadata or project). If the
/// info can't be loaded, it will be created (and persisted if possible).
/// </summary>
private
static
Task
<
SymbolTreeInfo
>
LoadOrCreateSourceSymbolTreeInfoAsync
(
Project
project
,
Checksum
checksum
,
bool
loadOnly
,
CancellationToken
cancellationToken
)
{
return
TryLoadOrCreateAsync
(
project
.
Solution
,
checksum
,
project
.
FilePath
,
loadOnly
,
createAsync
:
()
=>
CreateSourceSymbolTreeInfoAsync
(
project
,
checksum
,
cancellationToken
),
keySuffix
:
"_Source"
,
getPersistedChecksum
:
info
=>
info
.
Checksum
,
readObject
:
reader
=>
ReadSymbolTreeInfo
(
reader
,
(
names
,
nodes
)
=>
GetSpellCheckerTask
(
project
.
Solution
,
checksum
,
project
.
FilePath
,
names
,
nodes
)),
cancellationToken
:
cancellationToken
);
}
/// <summary>
/// Loads the SpellChecker for a given assembly symbol (metadata or project). If the
/// info can't be loaded, it will be created (and persisted if possible).
...
...
@@ -48,7 +29,7 @@ internal partial class SymbolTreeInfo : IObjectWritable
string
filePath
,
Func
<
Task
<
SpellChecker
>>
createAsync
)
{
return
TryLoadOrCreateAsync
(
var
result
=
TryLoadOrCreateAsync
(
solution
,
checksum
,
filePath
,
...
...
@@ -58,6 +39,8 @@ internal partial class SymbolTreeInfo : IObjectWritable
getPersistedChecksum
:
s
=>
s
.
Checksum
,
readObject
:
SpellChecker
.
ReadFrom
,
cancellationToken
:
CancellationToken
.
None
);
Contract
.
ThrowIfNull
(
result
,
"Result should never be null as we passed 'loadOnly: false'."
);
return
result
;
}
/// <summary>
...
...
src/Workspaces/Core/Portable/FindSymbols/SymbolTree/SymbolTreeInfo_Source.cs
浏览文件 @
b4c9c9e6
...
...
@@ -29,9 +29,17 @@ private static void FreeSymbolMap(MultiDictionary<string, ISymbol> symbolMap)
public
static
Task
<
SymbolTreeInfo
>
GetInfoForSourceAssemblyAsync
(
Project
project
,
Checksum
checksum
,
CancellationToken
cancellationToken
)
{
var
result
=
LoadOrCreateSourceSymbolTreeInfoAsync
(
project
,
checksum
,
loadOnly
:
false
,
cancellationToken
:
cancellationToken
);
Contract
.
ThrowIfNull
(
result
);
var
result
=
TryLoadOrCreateAsync
(
project
.
Solution
,
checksum
,
project
.
FilePath
,
loadOnly
:
false
,
createAsync
:
()
=>
CreateSourceSymbolTreeInfoAsync
(
project
,
checksum
,
cancellationToken
),
keySuffix
:
"_Source"
,
getPersistedChecksum
:
info
=>
info
.
Checksum
,
readObject
:
reader
=>
ReadSymbolTreeInfo
(
reader
,
(
names
,
nodes
)
=>
GetSpellCheckerTask
(
project
.
Solution
,
checksum
,
project
.
FilePath
,
names
,
nodes
)),
cancellationToken
:
cancellationToken
);
Contract
.
ThrowIfNull
(
result
,
"Result should never be null as we passed 'loadOnly: false'."
);
return
result
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录