Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
6ba5d167
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,发现更多精彩内容 >>
提交
6ba5d167
编写于
6月 17, 2020
作者:
C
Cyrus Najmabadi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
simplify
上级
6bf803e6
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
7 addition
and
9 deletion
+7
-9
src/Features/Core/Portable/GenerateConstructorFromMembers/AbstractGenerateConstructorFromMembersCodeRefactoringProvider.ConstructorDelegatingCodeAction.cs
...odeRefactoringProvider.ConstructorDelegatingCodeAction.cs
+3
-3
src/Features/Core/Portable/GenerateConstructorFromMembers/AbstractGenerateConstructorFromMembersCodeRefactoringProvider.cs
...tGenerateConstructorFromMembersCodeRefactoringProvider.cs
+4
-6
未找到文件。
src/Features/Core/Portable/GenerateConstructorFromMembers/AbstractGenerateConstructorFromMembersCodeRefactoringProvider.ConstructorDelegatingCodeAction.cs
浏览文件 @
6ba5d167
...
...
@@ -53,8 +53,8 @@ protected override async Task<Document> GetChangedDocumentAsync(CancellationToke
var
thisConstructorArguments
=
factory
.
CreateArguments
(
_state
.
Parameters
.
Take
(
_state
.
DelegatedConstructor
.
Parameters
.
Length
).
ToImmutableArray
());
var
nullCheckStatements
=
ArrayBuilder
<
SyntaxNode
>.
GetInstance
(
);
var
assignStatements
=
ArrayBuilder
<
SyntaxNode
>.
GetInstance
(
);
using
var
_1
=
ArrayBuilder
<
SyntaxNode
>.
GetInstance
(
out
var
nullCheckStatements
);
using
var
_2
=
ArrayBuilder
<
SyntaxNode
>.
GetInstance
(
out
var
assignStatements
);
var
options
=
await
_document
.
GetOptionsAsync
(
cancellationToken
).
ConfigureAwait
(
false
);
var
useThrowExpressions
=
_service
.
PrefersThrowExpression
(
options
);
...
...
@@ -84,7 +84,7 @@ protected override async Task<Document> GetChangedDocumentAsync(CancellationToke
?
syntaxTree
.
GetLocation
(
_state
.
TextSpan
)
:
null
;
var
statements
=
nullCheckStatements
.
ToImmutable
AndFree
().
Concat
(
assignStatements
.
ToImmutableAndFre
e
());
var
statements
=
nullCheckStatements
.
ToImmutable
().
Concat
(
assignStatements
.
ToImmutabl
e
());
var
result
=
await
codeGenerationService
.
AddMethodAsync
(
_document
.
Project
.
Solution
,
_state
.
ContainingType
,
...
...
src/Features/Core/Portable/GenerateConstructorFromMembers/AbstractGenerateConstructorFromMembersCodeRefactoringProvider.cs
浏览文件 @
6ba5d167
...
...
@@ -109,7 +109,7 @@ private async Task HandleNonSelectionAsync(CodeRefactoringContext context)
return
;
}
var
pickMemberOptions
=
ArrayBuilder
<
PickMembersOption
>.
GetInstance
(
);
using
var
_
=
ArrayBuilder
<
PickMembersOption
>.
GetInstance
(
out
var
pickMemberOptions
);
var
canAddNullCheck
=
viableMembers
.
Any
(
m
=>
m
.
GetSymbolType
().
CanAddNullCheck
());
...
...
@@ -127,7 +127,7 @@ private async Task HandleNonSelectionAsync(CodeRefactoringContext context)
context
.
RegisterRefactoring
(
new
GenerateConstructorWithDialogCodeAction
(
this
,
document
,
textSpan
,
containingType
,
viableMembers
,
pickMemberOptions
.
ToImmutable
AndFree
()),
pickMemberOptions
.
ToImmutable
()),
typeDeclaration
.
Span
);
}
...
...
@@ -152,15 +152,13 @@ private async Task HandleNonSelectionAsync(CodeRefactoringContext context)
private
ImmutableArray
<
CodeAction
>
GetCodeActions
(
Document
document
,
State
state
,
bool
addNullChecks
)
{
var
result
=
ArrayBuilder
<
CodeAction
>.
GetInstance
(
);
using
var
_
=
ArrayBuilder
<
CodeAction
>.
GetInstance
(
out
var
result
);
result
.
Add
(
new
FieldDelegatingCodeAction
(
this
,
document
,
state
,
addNullChecks
));
if
(
state
.
DelegatedConstructor
!=
null
)
{
result
.
Add
(
new
ConstructorDelegatingCodeAction
(
this
,
document
,
state
,
addNullChecks
));
}
return
result
.
ToImmutable
AndFree
();
return
result
.
ToImmutable
();
}
private
static
async
Task
<
Document
>
AddNavigationAnnotationAsync
(
Document
document
,
CancellationToken
cancellationToken
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录