Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
2a740c35
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,发现更多精彩内容 >>
未验证
提交
2a740c35
编写于
12月 19, 2019
作者:
J
Jared Parsons
提交者:
GitHub
12月 19, 2019
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #40484 from jaredpar/nullable2.1
Remove null from Diagnostic.Arguments
上级
ec603dc6
1fd1ff3c
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
29 addition
and
25 deletion
+29
-25
.vscode/tasks.json
.vscode/tasks.json
+12
-0
src/Compilers/Core/Portable/Diagnostic/Diagnostic.DiagnosticWithProgrammaticSuppression.cs
...ostic/Diagnostic.DiagnosticWithProgrammaticSuppression.cs
+1
-1
src/Compilers/Core/Portable/Diagnostic/Diagnostic.cs
src/Compilers/Core/Portable/Diagnostic/Diagnostic.cs
+1
-1
src/Compilers/Core/Portable/Diagnostic/DiagnosticInfo.cs
src/Compilers/Core/Portable/Diagnostic/DiagnosticInfo.cs
+14
-22
src/Compilers/Core/Portable/Diagnostic/DiagnosticWithInfo.cs
src/Compilers/Core/Portable/Diagnostic/DiagnosticWithInfo.cs
+1
-1
未找到文件。
.vscode/tasks.json
浏览文件 @
2a740c35
...
...
@@ -21,6 +21,18 @@
],
"problemMatcher"
:
"$msCompile"
,
"group"
:
"build"
},
{
"label"
:
"build csc skip analyzers"
,
"command"
:
"dotnet"
,
"type"
:
"shell"
,
"args"
:
[
"msbuild"
,
"src/Compilers/CSharp/csc/csc.csproj"
,
"-p:UseRoslynAnalyzers=false"
],
"problemMatcher"
:
"$msCompile"
,
"group"
:
"build"
}
]
}
src/Compilers/Core/Portable/Diagnostic/Diagnostic.DiagnosticWithProgrammaticSuppression.cs
浏览文件 @
2a740c35
...
...
@@ -43,7 +43,7 @@ public override string Id
public
override
string
GetMessage
(
IFormatProvider
?
formatProvider
=
null
)
=>
_originalUnsuppressedDiagnostic
.
GetMessage
(
formatProvider
);
internal
override
IReadOnlyList
<
object
?>
?
Arguments
internal
override
IReadOnlyList
<
object
?>
Arguments
{
get
{
return
_originalUnsuppressedDiagnostic
.
Arguments
;
}
}
...
...
src/Compilers/Core/Portable/Diagnostic/Diagnostic.cs
浏览文件 @
2a740c35
...
...
@@ -466,7 +466,7 @@ internal Diagnostic WithProgrammaticSuppression(ProgrammaticSuppressionInfo prog
// compatibility
internal
virtual
int
Code
{
get
{
return
0
;
}
}
internal
virtual
IReadOnlyList
<
object
?>
?
Arguments
internal
virtual
IReadOnlyList
<
object
?>
Arguments
{
get
{
return
SpecializedCollections
.
EmptyReadOnlyList
<
object
?>();
}
}
...
...
src/Compilers/Core/Portable/Diagnostic/DiagnosticInfo.cs
浏览文件 @
2a740c35
...
...
@@ -28,7 +28,7 @@ internal class DiagnosticInfo : IFormattable, IObjectWritable
private
readonly
int
_errorCode
;
private
readonly
DiagnosticSeverity
_defaultSeverity
;
private
readonly
DiagnosticSeverity
_effectiveSeverity
;
private
readonly
object
[]
?
_arguments
;
private
readonly
object
[]
_arguments
;
private
static
ImmutableDictionary
<
int
,
DiagnosticDescriptor
>
s_errorCodeToDescriptorMap
=
ImmutableDictionary
<
int
,
DiagnosticDescriptor
>.
Empty
;
...
...
@@ -48,6 +48,7 @@ internal DiagnosticInfo(CommonMessageProvider messageProvider, int errorCode)
_errorCode
=
errorCode
;
_defaultSeverity
=
messageProvider
.
GetSeverity
(
errorCode
);
_effectiveSeverity
=
_defaultSeverity
;
_arguments
=
Array
.
Empty
<
object
>();
}
// Only the compiler creates instances.
...
...
@@ -155,12 +156,12 @@ protected virtual void WriteTo(ObjectWriter writer)
writer
.
WriteInt32
((
int
)
_effectiveSeverity
);
writer
.
WriteInt32
((
int
)
_defaultSeverity
);
int
count
=
_arguments
?.
Length
??
0
;
int
count
=
_arguments
.
Length
;
writer
.
WriteUInt32
((
uint
)
count
);
if
(
count
>
0
)
{
foreach
(
var
arg
in
_arguments
!
)
foreach
(
var
arg
in
_arguments
)
{
writer
.
WriteString
(
arg
.
ToString
());
}
...
...
@@ -175,11 +176,7 @@ protected DiagnosticInfo(ObjectReader reader)
_defaultSeverity
=
(
DiagnosticSeverity
)
reader
.
ReadInt32
();
var
count
=
(
int
)
reader
.
ReadUInt32
();
if
(
count
==
0
)
{
_arguments
=
Array
.
Empty
<
object
>();
}
else
if
(
count
>
0
)
if
(
count
>
0
)
{
_arguments
=
new
string
[
count
];
for
(
int
i
=
0
;
i
<
count
;
i
++)
...
...
@@ -187,6 +184,10 @@ protected DiagnosticInfo(ObjectReader reader)
_arguments
[
i
]
=
reader
.
ReadString
();
}
}
else
{
_arguments
=
Array
.
Empty
<
object
>();
}
}
#
endregion
...
...
@@ -331,7 +332,7 @@ public virtual string GetMessage(IFormatProvider? formatProvider = null)
return
string
.
Empty
;
}
if
(
_arguments
==
null
||
_arguments
.
Length
==
0
)
if
(
_arguments
.
Length
==
0
)
{
return
message
;
}
...
...
@@ -341,7 +342,6 @@ public virtual string GetMessage(IFormatProvider? formatProvider = null)
protected
object
[]
GetArgumentsToUse
(
IFormatProvider
?
formatProvider
)
{
RoslynDebug
.
Assert
(
_arguments
is
object
);
object
[]?
argumentsToUse
=
null
;
for
(
int
i
=
0
;
i
<
_arguments
.
Length
;
i
++)
{
...
...
@@ -371,14 +371,13 @@ private object[] InitializeArgumentListIfNeeded(object[]? argumentsToUse)
return
argumentsToUse
;
}
RoslynDebug
.
Assert
(
_arguments
!=
null
);
var
newArguments
=
new
object
[
_arguments
.
Length
];
Array
.
Copy
(
_arguments
,
newArguments
,
newArguments
.
Length
);
return
newArguments
;
}
internal
object
[]
?
Arguments
internal
object
[]
Arguments
{
get
{
return
_arguments
;
}
}
...
...
@@ -409,12 +408,9 @@ string IFormattable.ToString(string format, IFormatProvider? formatProvider)
public
sealed
override
int
GetHashCode
()
{
int
hashCode
=
_errorCode
;
if
(
_arguments
!=
null
)
for
(
int
i
=
0
;
i
<
_arguments
.
Length
;
i
++
)
{
for
(
int
i
=
0
;
i
<
_arguments
.
Length
;
i
++)
{
hashCode
=
Hash
.
Combine
(
_arguments
[
i
],
hashCode
);
}
hashCode
=
Hash
.
Combine
(
_arguments
[
i
],
hashCode
);
}
return
hashCode
;
...
...
@@ -430,11 +426,7 @@ public sealed override bool Equals(object? obj)
other
.
_errorCode
==
_errorCode
&&
other
.
GetType
()
==
this
.
GetType
())
{
if
(
_arguments
==
null
&&
other
.
_arguments
==
null
)
{
result
=
true
;
}
else
if
(
_arguments
!=
null
&&
other
.
_arguments
!=
null
&&
_arguments
.
Length
==
other
.
_arguments
.
Length
)
if
(
_arguments
.
Length
==
other
.
_arguments
.
Length
)
{
result
=
true
;
for
(
int
i
=
0
;
i
<
_arguments
.
Length
;
i
++)
...
...
src/Compilers/Core/Portable/Diagnostic/DiagnosticWithInfo.cs
浏览文件 @
2a740c35
...
...
@@ -102,7 +102,7 @@ public override string GetMessage(IFormatProvider? formatProvider = null)
return
this
.
Info
.
GetMessage
(
formatProvider
);
}
internal
override
IReadOnlyList
<
object
>
?
Arguments
internal
override
IReadOnlyList
<
object
>
Arguments
{
get
{
return
this
.
Info
.
Arguments
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录