Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
2d39a70f
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,发现更多精彩内容 >>
提交
2d39a70f
编写于
1月 18, 2019
作者:
V
vepanimas
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fixed review concerns for CS8345 code fix
上级
856be78a
变更
16
隐藏空白更改
内联
并排
Showing
16 changed file
with
54 addition
and
57 deletion
+54
-57
src/Features/CSharp/Portable/CSharpFeaturesResources.Designer.cs
...tures/CSharp/Portable/CSharpFeaturesResources.Designer.cs
+1
-1
src/Features/CSharp/Portable/CSharpFeaturesResources.resx
src/Features/CSharp/Portable/CSharpFeaturesResources.resx
+2
-1
src/Features/CSharp/Portable/MakeRefStruct/CSharpMakeRefStructCodeFixProvider.cs
...table/MakeRefStruct/CSharpMakeRefStructCodeFixProvider.cs
+12
-16
src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.cs.xlf
...atures/CSharp/Portable/xlf/CSharpFeaturesResources.cs.xlf
+3
-3
src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.de.xlf
...atures/CSharp/Portable/xlf/CSharpFeaturesResources.de.xlf
+3
-3
src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.es.xlf
...atures/CSharp/Portable/xlf/CSharpFeaturesResources.es.xlf
+3
-3
src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.fr.xlf
...atures/CSharp/Portable/xlf/CSharpFeaturesResources.fr.xlf
+3
-3
src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.it.xlf
...atures/CSharp/Portable/xlf/CSharpFeaturesResources.it.xlf
+3
-3
src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.ja.xlf
...atures/CSharp/Portable/xlf/CSharpFeaturesResources.ja.xlf
+3
-3
src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.ko.xlf
...atures/CSharp/Portable/xlf/CSharpFeaturesResources.ko.xlf
+3
-3
src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.pl.xlf
...atures/CSharp/Portable/xlf/CSharpFeaturesResources.pl.xlf
+3
-3
src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.pt-BR.xlf
...res/CSharp/Portable/xlf/CSharpFeaturesResources.pt-BR.xlf
+3
-3
src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.ru.xlf
...atures/CSharp/Portable/xlf/CSharpFeaturesResources.ru.xlf
+3
-3
src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.tr.xlf
...atures/CSharp/Portable/xlf/CSharpFeaturesResources.tr.xlf
+3
-3
src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.zh-Hans.xlf
...s/CSharp/Portable/xlf/CSharpFeaturesResources.zh-Hans.xlf
+3
-3
src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.zh-Hant.xlf
...s/CSharp/Portable/xlf/CSharpFeaturesResources.zh-Hant.xlf
+3
-3
未找到文件。
src/Features/CSharp/Portable/CSharpFeaturesResources.Designer.cs
浏览文件 @
2d39a70f
...
...
@@ -800,7 +800,7 @@ internal class CSharpFeaturesResources {
}
/// <summary>
/// Looks up a localized string similar to Make
ref struct
.
/// Looks up a localized string similar to Make
'ref struct'
.
/// </summary>
internal
static
string
Make_ref_struct
{
get
{
...
...
src/Features/CSharp/Portable/CSharpFeaturesResources.resx
浏览文件 @
2d39a70f
...
...
@@ -587,6 +587,7 @@
<comment>
{Locked="using"} "using" is a C# keyword and should not be localized.
</comment>
</data>
<data
name=
"Make_ref_struct"
xml:space=
"preserve"
>
<value>
Make ref struct
</value>
<value>
Make 'ref struct'
</value>
<comment>
{Locked="ref"}{Locked="struct"} "ref" and "struct" are C# keywords and should not be localized.
</comment>
</data>
</root>
src/Features/CSharp/Portable/MakeRefStruct/CSharpMakeRefStructCodeFixProvider.cs
浏览文件 @
2d39a70f
...
...
@@ -34,27 +34,27 @@ public override async Task RegisterCodeFixesAsync(CodeFixContext context)
var
structDeclaration
=
FindContainingStruct
(
root
,
span
);
// CS8345 could be triggered when struct is already marked with `ref` but a property is static
if
(
structDeclaration
!=
null
&&
!
structDeclaration
.
Modifiers
.
Any
(
m
=>
m
.
IsKind
(
SyntaxKind
.
RefKeyword
)
))
if
(
structDeclaration
!=
null
&&
!
structDeclaration
.
Modifiers
.
Any
(
SyntaxKind
.
RefKeyword
))
{
context
.
RegisterCodeFix
(
new
MyCodeAction
(
CSharpFeaturesResources
.
Make_ref_struct
,
c
=>
FixCodeAsync
(
context
.
Document
,
context
.
Span
,
c
)),
new
MyCodeAction
(
c
=>
FixCodeAsync
(
document
,
span
,
c
)),
context
.
Diagnostics
);
}
}
public
override
FixAllProvider
GetFixAllProvider
()
{
return
WellKnownFixAllProviders
.
BatchFixer
;
// The chance of needing fix-all in these cases is super low
return
null
;
}
private
async
Task
<
Document
>
FixCodeAsync
(
Document
document
,
TextSpan
span
,
CancellationToken
c
)
private
async
Task
<
Document
>
FixCodeAsync
(
Document
document
,
TextSpan
span
,
CancellationToken
c
ancellationToken
)
{
var
root
=
await
document
.
GetSyntaxRootAsync
(
c
).
ConfigureAwait
(
false
);
var
root
=
await
document
.
GetSyntaxRootAsync
(
cancellationToken
).
ConfigureAwait
(
false
);
var
gen
=
SyntaxGenerator
.
GetGenerator
(
document
);
var
structDeclaration
=
FindContainingStruct
(
root
,
span
);
var
newStruct
=
UpdateStructDeclaration
(
document
,
structDeclaration
);
var
newStruct
=
gen
.
WithModifiers
(
structDeclaration
,
gen
.
GetModifiers
(
structDeclaration
).
WithIsRef
(
true
)
);
var
newRoot
=
root
.
ReplaceNode
(
structDeclaration
,
newStruct
);
return
document
.
WithSyntaxRoot
(
newRoot
);
...
...
@@ -68,16 +68,12 @@ private StructDeclarationSyntax FindContainingStruct(SyntaxNode root, TextSpan s
return
member
.
GetAncestor
<
TypeDeclarationSyntax
>()
as
StructDeclarationSyntax
;
}
private
SyntaxNode
UpdateStructDeclaration
(
Document
document
,
StructDeclarationSyntax
decl
)
{
var
gen
=
SyntaxGenerator
.
GetGenerator
(
document
);
return
gen
.
WithModifiers
(
decl
,
gen
.
GetModifiers
(
decl
).
WithIsRef
(
true
));
}
private
class
MyCodeAction
:
CodeAction
.
DocumentChangeAction
{
public
MyCodeAction
(
string
title
,
Func
<
CancellationToken
,
Task
<
Document
>>
createChangedDocument
)
:
base
(
title
,
createChangedDocument
,
title
)
public
MyCodeAction
(
Func
<
CancellationToken
,
Task
<
Document
>>
createChangedDocument
)
:
base
(
CSharpFeaturesResources
.
Make_ref_struct
,
createChangedDocument
,
CSharpFeaturesResources
.
Make_ref_struct
)
{
}
}
...
...
src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.cs.xlf
浏览文件 @
2d39a70f
...
...
@@ -93,9 +93,9 @@
<note
/>
</trans-unit>
<trans-unit
id=
"Make_ref_struct"
>
<source>
Make
ref struct
</source>
<target
state=
"new"
>
Make
ref struct
</target>
<note
/
>
<source>
Make
'ref struct'
</source>
<target
state=
"new"
>
Make
'ref struct'
</target>
<note
>
{Locked="ref"}{Locked="struct"} "ref" and "struct" are C# keywords and should not be localized.
</note
>
</trans-unit>
<trans-unit
id=
"Remove_unnecessary_casts"
>
<source>
Remove unnecessary casts
</source>
...
...
src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.de.xlf
浏览文件 @
2d39a70f
...
...
@@ -93,9 +93,9 @@
<note
/>
</trans-unit>
<trans-unit
id=
"Make_ref_struct"
>
<source>
Make
ref struct
</source>
<target
state=
"new"
>
Make
ref struct
</target>
<note
/
>
<source>
Make
'ref struct'
</source>
<target
state=
"new"
>
Make
'ref struct'
</target>
<note
>
{Locked="ref"}{Locked="struct"} "ref" and "struct" are C# keywords and should not be localized.
</note
>
</trans-unit>
<trans-unit
id=
"Remove_unnecessary_casts"
>
<source>
Remove unnecessary casts
</source>
...
...
src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.es.xlf
浏览文件 @
2d39a70f
...
...
@@ -93,9 +93,9 @@
<note
/>
</trans-unit>
<trans-unit
id=
"Make_ref_struct"
>
<source>
Make
ref struct
</source>
<target
state=
"new"
>
Make
ref struct
</target>
<note
/
>
<source>
Make
'ref struct'
</source>
<target
state=
"new"
>
Make
'ref struct'
</target>
<note
>
{Locked="ref"}{Locked="struct"} "ref" and "struct" are C# keywords and should not be localized.
</note
>
</trans-unit>
<trans-unit
id=
"Remove_unnecessary_casts"
>
<source>
Remove unnecessary casts
</source>
...
...
src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.fr.xlf
浏览文件 @
2d39a70f
...
...
@@ -93,9 +93,9 @@
<note
/>
</trans-unit>
<trans-unit
id=
"Make_ref_struct"
>
<source>
Make
ref struct
</source>
<target
state=
"new"
>
Make
ref struct
</target>
<note
/
>
<source>
Make
'ref struct'
</source>
<target
state=
"new"
>
Make
'ref struct'
</target>
<note
>
{Locked="ref"}{Locked="struct"} "ref" and "struct" are C# keywords and should not be localized.
</note
>
</trans-unit>
<trans-unit
id=
"Remove_unnecessary_casts"
>
<source>
Remove unnecessary casts
</source>
...
...
src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.it.xlf
浏览文件 @
2d39a70f
...
...
@@ -93,9 +93,9 @@
<note
/>
</trans-unit>
<trans-unit
id=
"Make_ref_struct"
>
<source>
Make
ref struct
</source>
<target
state=
"new"
>
Make
ref struct
</target>
<note
/
>
<source>
Make
'ref struct'
</source>
<target
state=
"new"
>
Make
'ref struct'
</target>
<note
>
{Locked="ref"}{Locked="struct"} "ref" and "struct" are C# keywords and should not be localized.
</note
>
</trans-unit>
<trans-unit
id=
"Remove_unnecessary_casts"
>
<source>
Remove unnecessary casts
</source>
...
...
src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.ja.xlf
浏览文件 @
2d39a70f
...
...
@@ -93,9 +93,9 @@
<note
/>
</trans-unit>
<trans-unit
id=
"Make_ref_struct"
>
<source>
Make
ref struct
</source>
<target
state=
"new"
>
Make
ref struct
</target>
<note
/
>
<source>
Make
'ref struct'
</source>
<target
state=
"new"
>
Make
'ref struct'
</target>
<note
>
{Locked="ref"}{Locked="struct"} "ref" and "struct" are C# keywords and should not be localized.
</note
>
</trans-unit>
<trans-unit
id=
"Remove_unnecessary_casts"
>
<source>
Remove unnecessary casts
</source>
...
...
src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.ko.xlf
浏览文件 @
2d39a70f
...
...
@@ -93,9 +93,9 @@
<note
/>
</trans-unit>
<trans-unit
id=
"Make_ref_struct"
>
<source>
Make
ref struct
</source>
<target
state=
"new"
>
Make
ref struct
</target>
<note
/
>
<source>
Make
'ref struct'
</source>
<target
state=
"new"
>
Make
'ref struct'
</target>
<note
>
{Locked="ref"}{Locked="struct"} "ref" and "struct" are C# keywords and should not be localized.
</note
>
</trans-unit>
<trans-unit
id=
"Remove_unnecessary_casts"
>
<source>
Remove unnecessary casts
</source>
...
...
src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.pl.xlf
浏览文件 @
2d39a70f
...
...
@@ -93,9 +93,9 @@
<note
/>
</trans-unit>
<trans-unit
id=
"Make_ref_struct"
>
<source>
Make
ref struct
</source>
<target
state=
"new"
>
Make
ref struct
</target>
<note
/
>
<source>
Make
'ref struct'
</source>
<target
state=
"new"
>
Make
'ref struct'
</target>
<note
>
{Locked="ref"}{Locked="struct"} "ref" and "struct" are C# keywords and should not be localized.
</note
>
</trans-unit>
<trans-unit
id=
"Remove_unnecessary_casts"
>
<source>
Remove unnecessary casts
</source>
...
...
src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.pt-BR.xlf
浏览文件 @
2d39a70f
...
...
@@ -93,9 +93,9 @@
<note
/>
</trans-unit>
<trans-unit
id=
"Make_ref_struct"
>
<source>
Make
ref struct
</source>
<target
state=
"new"
>
Make
ref struct
</target>
<note
/
>
<source>
Make
'ref struct'
</source>
<target
state=
"new"
>
Make
'ref struct'
</target>
<note
>
{Locked="ref"}{Locked="struct"} "ref" and "struct" are C# keywords and should not be localized.
</note
>
</trans-unit>
<trans-unit
id=
"Remove_unnecessary_casts"
>
<source>
Remove unnecessary casts
</source>
...
...
src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.ru.xlf
浏览文件 @
2d39a70f
...
...
@@ -93,9 +93,9 @@
<note
/>
</trans-unit>
<trans-unit
id=
"Make_ref_struct"
>
<source>
Make
ref struct
</source>
<target
state=
"new"
>
Make
ref struct
</target>
<note
/
>
<source>
Make
'ref struct'
</source>
<target
state=
"new"
>
Make
'ref struct'
</target>
<note
>
{Locked="ref"}{Locked="struct"} "ref" and "struct" are C# keywords and should not be localized.
</note
>
</trans-unit>
<trans-unit
id=
"Remove_unnecessary_casts"
>
<source>
Remove unnecessary casts
</source>
...
...
src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.tr.xlf
浏览文件 @
2d39a70f
...
...
@@ -93,9 +93,9 @@
<note
/>
</trans-unit>
<trans-unit
id=
"Make_ref_struct"
>
<source>
Make
ref struct
</source>
<target
state=
"new"
>
Make
ref struct
</target>
<note
/
>
<source>
Make
'ref struct'
</source>
<target
state=
"new"
>
Make
'ref struct'
</target>
<note
>
{Locked="ref"}{Locked="struct"} "ref" and "struct" are C# keywords and should not be localized.
</note
>
</trans-unit>
<trans-unit
id=
"Remove_unnecessary_casts"
>
<source>
Remove unnecessary casts
</source>
...
...
src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.zh-Hans.xlf
浏览文件 @
2d39a70f
...
...
@@ -93,9 +93,9 @@
<note
/>
</trans-unit>
<trans-unit
id=
"Make_ref_struct"
>
<source>
Make
ref struct
</source>
<target
state=
"new"
>
Make
ref struct
</target>
<note
/
>
<source>
Make
'ref struct'
</source>
<target
state=
"new"
>
Make
'ref struct'
</target>
<note
>
{Locked="ref"}{Locked="struct"} "ref" and "struct" are C# keywords and should not be localized.
</note
>
</trans-unit>
<trans-unit
id=
"Remove_unnecessary_casts"
>
<source>
Remove unnecessary casts
</source>
...
...
src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.zh-Hant.xlf
浏览文件 @
2d39a70f
...
...
@@ -93,9 +93,9 @@
<note
/>
</trans-unit>
<trans-unit
id=
"Make_ref_struct"
>
<source>
Make
ref struct
</source>
<target
state=
"new"
>
Make
ref struct
</target>
<note
/
>
<source>
Make
'ref struct'
</source>
<target
state=
"new"
>
Make
'ref struct'
</target>
<note
>
{Locked="ref"}{Locked="struct"} "ref" and "struct" are C# keywords and should not be localized.
</note
>
</trans-unit>
<trans-unit
id=
"Remove_unnecessary_casts"
>
<source>
Remove unnecessary casts
</source>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录