Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
60e41b21
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,发现更多精彩内容 >>
提交
60e41b21
编写于
4月 12, 2016
作者:
H
Heejae Chang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
added comment based on PR.
上级
2920c155
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
27 addition
and
2 deletion
+27
-2
src/Features/Core/Portable/Diagnostics/EngineV2/DiagnosticIncrementalAnalyzer.Executor.cs
...ostics/EngineV2/DiagnosticIncrementalAnalyzer.Executor.cs
+12
-0
src/Features/Core/Portable/Diagnostics/EngineV2/DiagnosticIncrementalAnalyzer.ProjectState.cs
...cs/EngineV2/DiagnosticIncrementalAnalyzer.ProjectState.cs
+15
-2
未找到文件。
src/Features/Core/Portable/Diagnostics/EngineV2/DiagnosticIncrementalAnalyzer.Executor.cs
浏览文件 @
60e41b21
...
...
@@ -41,6 +41,9 @@ public IEnumerable<DiagnosticData> ConvertToLocalDiagnostics(Document targetDocu
return
ConvertToLocalDiagnosticsWithoutCompilation
(
targetDocument
,
diagnostics
,
span
);
}
/// <summary>
/// Return all local diagnostics (syntax, semantic) that belong to given document for the given StateSet (analyzer) either from cache or by calculating them
/// </summary>
public
async
Task
<
DocumentAnalysisData
>
GetDocumentAnalysisDataAsync
(
CompilationWithAnalyzers
analyzerDriverOpt
,
Document
document
,
StateSet
stateSet
,
AnalysisKind
kind
,
CancellationToken
cancellationToken
)
{
...
...
@@ -74,6 +77,9 @@ public IEnumerable<DiagnosticData> ConvertToLocalDiagnostics(Document targetDocu
}
}
/// <summary>
/// Return all diagnostics that belong to given project for the given StateSets (analyzers) either from cache or by calculating them
/// </summary>
public
async
Task
<
ProjectAnalysisData
>
GetProjectAnalysisDataAsync
(
CompilationWithAnalyzers
analyzerDriverOpt
,
Project
project
,
IEnumerable
<
StateSet
>
stateSets
,
CancellationToken
cancellationToken
)
{
...
...
@@ -105,6 +111,9 @@ public IEnumerable<DiagnosticData> ConvertToLocalDiagnostics(Document targetDocu
}
}
/// <summary>
/// Return all local diagnostics (syntax, semantic) that belong to given document for the given StateSet (analyzer) by calculating them
/// </summary>
public
async
Task
<
IEnumerable
<
DiagnosticData
>>
ComputeDiagnosticsAsync
(
CompilationWithAnalyzers
analyzerDriverOpt
,
Document
document
,
DiagnosticAnalyzer
analyzer
,
AnalysisKind
kind
,
TextSpan
?
spanOpt
,
CancellationToken
cancellationToken
)
{
...
...
@@ -119,6 +128,9 @@ public IEnumerable<DiagnosticData> ConvertToLocalDiagnostics(Document targetDocu
return
ConvertToLocalDiagnostics
(
document
,
documentDiagnostics
);
}
/// <summary>
/// Return all diagnostics that belong to given project for the given StateSets (analyzers) by calculating them
/// </summary>
public
async
Task
<
ImmutableDictionary
<
DiagnosticAnalyzer
,
AnalysisResult
>>
ComputeDiagnosticsAsync
(
CompilationWithAnalyzers
analyzerDriverOpt
,
Project
project
,
IEnumerable
<
StateSet
>
stateSets
,
CancellationToken
cancellationToken
)
{
...
...
src/Features/Core/Portable/Diagnostics/EngineV2/DiagnosticIncrementalAnalyzer.ProjectState.cs
浏览文件 @
60e41b21
...
...
@@ -42,6 +42,9 @@ public bool IsEmpty(DocumentId documentId)
return
IsEmpty
(
_lastResult
,
documentId
);
}
/// <summary>
/// Return all diagnostics for the given project stored in this state
/// </summary>
public
async
Task
<
AnalysisResult
>
GetAnalysisDataAsync
(
Project
project
,
bool
avoidLoadingData
,
CancellationToken
cancellationToken
)
{
// make a copy of last result.
...
...
@@ -54,14 +57,14 @@ public async Task<AnalysisResult> GetAnalysisDataAsync(Project project, bool avo
}
// PERF: avoid loading data if version is not right one.
// avoid loading data flag is there as a stric
k
ly perf optimization.
// avoid loading data flag is there as a stric
t
ly perf optimization.
var
version
=
await
GetDiagnosticVersionAsync
(
project
,
cancellationToken
).
ConfigureAwait
(
false
);
if
(
avoidLoadingData
&&
lastResult
.
Version
!=
version
)
{
return
lastResult
;
}
// if given
documen
t doesnt have any diagnostics, return empty.
// if given
projec
t doesnt have any diagnostics, return empty.
if
(
lastResult
.
IsEmpty
)
{
return
new
AnalysisResult
(
lastResult
.
ProjectId
,
lastResult
.
Version
);
...
...
@@ -73,6 +76,8 @@ public async Task<AnalysisResult> GetAnalysisDataAsync(Project project, bool avo
foreach
(
var
documentId
in
lastResult
.
DocumentIds
)
{
cancellationToken
.
ThrowIfCancellationRequested
();
var
document
=
project
.
GetDocument
(
documentId
);
if
(
document
==
null
)
{
...
...
@@ -94,6 +99,9 @@ public async Task<AnalysisResult> GetAnalysisDataAsync(Project project, bool avo
return
builder
.
ToResult
();
}
/// <summary>
/// Return all diagnostics for the given document stored in this state including non local diagnostics for this document
/// </summary>
public
async
Task
<
AnalysisResult
>
GetAnalysisDataAsync
(
Document
document
,
bool
avoidLoadingData
,
CancellationToken
cancellationToken
)
{
// make a copy of last result.
...
...
@@ -129,6 +137,9 @@ public async Task<AnalysisResult> GetAnalysisDataAsync(Document document, bool a
return
builder
.
ToResult
();
}
/// <summary>
/// Return all no location diagnostics for the given project stored in this state
/// </summary>
public
async
Task
<
AnalysisResult
>
GetProjectAnalysisDataAsync
(
Project
project
,
bool
avoidLoadingData
,
CancellationToken
cancellationToken
)
{
// make a copy of last result.
...
...
@@ -209,6 +220,8 @@ private async Task<AnalysisResult> LoadInitialAnalysisDataAsync(Project project,
foreach
(
var
document
in
project
.
Documents
)
{
cancellationToken
.
ThrowIfCancellationRequested
();
if
(!
await
TryDeserializeDocumentAsync
(
serializer
,
document
,
builder
,
cancellationToken
).
ConfigureAwait
(
false
))
{
continue
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录