Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
a09ea02b
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,发现更多精彩内容 >>
提交
a09ea02b
编写于
3月 08, 2016
作者:
J
Julien Couvreur
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix for #7840: add missing check for DynamicAttribute type
上级
9927226d
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
17 addition
and
14 deletion
+17
-14
src/Compilers/CSharp/Portable/Compilation/CSharpCompilation.cs
...ompilers/CSharp/Portable/Compilation/CSharpCompilation.cs
+11
-0
src/Compilers/CSharp/Portable/Symbols/Synthesized/SynthesizedFieldSymbolBase.cs
...ortable/Symbols/Synthesized/SynthesizedFieldSymbolBase.cs
+2
-5
src/Compilers/CSharp/Portable/Symbols/Synthesized/SynthesizedImplementationMethod.cs
...le/Symbols/Synthesized/SynthesizedImplementationMethod.cs
+2
-2
src/Compilers/CSharp/Portable/Symbols/Synthesized/SynthesizedParameterSymbol.cs
...ortable/Symbols/Synthesized/SynthesizedParameterSymbol.cs
+2
-7
未找到文件。
src/Compilers/CSharp/Portable/Compilation/CSharpCompilation.cs
浏览文件 @
a09ea02b
...
...
@@ -2879,6 +2879,17 @@ internal bool HasDynamicEmitAttributes()
(
object
)
GetWellKnownTypeMember
(
WellKnownMember
.
System_Runtime_CompilerServices_DynamicAttribute__ctorTransformFlags
)
!=
null
;
}
/// <summary>
/// Returns whether the compilation has the Boolean type and if it's good.
/// </summary>
/// <returns>Returns true if Boolean is present and healthy.</returns>
internal
bool
CanEmitBoolean
()
{
var
boolType
=
GetSpecialType
(
SpecialType
.
System_Boolean
);
var
diagnostic
=
boolType
.
GetUseSiteDiagnostic
();
return
(
diagnostic
==
null
)
||
(
diagnostic
.
Severity
!=
DiagnosticSeverity
.
Error
);
}
internal
override
AnalyzerDriver
AnalyzerForLanguage
(
ImmutableArray
<
DiagnosticAnalyzer
>
analyzers
,
AnalyzerManager
analyzerManager
)
{
Func
<
SyntaxNode
,
SyntaxKind
>
getKind
=
node
=>
node
.
Kind
();
...
...
src/Compilers/CSharp/Portable/Symbols/Synthesized/SynthesizedFieldSymbolBase.cs
浏览文件 @
a09ea02b
...
...
@@ -45,14 +45,11 @@ internal override void AddSynthesizedAttributes(ModuleCompilationState compilati
CSharpCompilation
compilation
=
this
.
DeclaringCompilation
;
// Assume that someone checked earlier that the attribute ctor is available and has no use-site errors.
AddSynthesizedAttribute
(
ref
attributes
,
compilation
.
TrySynthesizeAttribute
(
WellKnownMember
.
System_Runtime_CompilerServices_CompilerGeneratedAttribute__ctor
));
// TODO (tomat): do we need to emit dynamic attribute on any synthesized field?
if
(
this
.
Type
.
ContainsDynamic
())
if
(
this
.
Type
.
ContainsDynamic
()
&&
compilation
.
HasDynamicEmitAttributes
()
&&
compilation
.
CanEmitBoolean
())
{
// Assume that someone checked earlier that the attribute ctor is available and has no use-site errors.
AddSynthesizedAttribute
(
ref
attributes
,
compilation
.
SynthesizeDynamicAttribute
(
this
.
Type
,
customModifiersCount
:
0
));
AddSynthesizedAttribute
(
ref
attributes
,
compilation
.
SynthesizeDynamicAttribute
(
this
.
Type
,
this
.
CustomModifiers
.
Length
));
}
}
...
...
src/Compilers/CSharp/Portable/Symbols/Synthesized/SynthesizedImplementationMethod.cs
浏览文件 @
a09ea02b
...
...
@@ -81,9 +81,9 @@ internal override void AddSynthesizedAttributes(ModuleCompilationState compilati
{
base
.
AddSynthesizedAttributes
(
compilationState
,
ref
attributes
);
if
(
this
.
ReturnType
.
ContainsDynamic
())
var
compilation
=
this
.
DeclaringCompilation
;
if
(
this
.
ReturnType
.
ContainsDynamic
()
&&
compilation
.
HasDynamicEmitAttributes
()
&&
compilation
.
CanEmitBoolean
())
{
var
compilation
=
this
.
DeclaringCompilation
;
AddSynthesizedAttribute
(
ref
attributes
,
compilation
.
SynthesizeDynamicAttribute
(
this
.
ReturnType
,
this
.
ReturnTypeCustomModifiers
.
Length
));
}
}
...
...
src/Compilers/CSharp/Portable/Symbols/Synthesized/SynthesizedParameterSymbol.cs
浏览文件 @
a09ea02b
...
...
@@ -159,14 +159,9 @@ internal override void AddSynthesizedAttributes(ModuleCompilationState compilati
// this is a no-op. Emitting an error here, or when the original parameter was bound, would
// adversely effect the compilation or potentially change overload resolution.
var
compilation
=
this
.
DeclaringCompilation
;
if
(
Type
.
ContainsDynamic
()
&&
compilation
.
HasDynamicEmitAttributes
())
if
(
Type
.
ContainsDynamic
()
&&
compilation
.
HasDynamicEmitAttributes
()
&&
compilation
.
CanEmitBoolean
()
)
{
var
boolType
=
compilation
.
GetSpecialType
(
SpecialType
.
System_Boolean
);
var
diagnostic
=
boolType
.
GetUseSiteDiagnostic
();
if
((
diagnostic
==
null
)
||
(
diagnostic
.
Severity
!=
DiagnosticSeverity
.
Error
))
{
AddSynthesizedAttribute
(
ref
attributes
,
compilation
.
SynthesizeDynamicAttribute
(
this
.
Type
,
this
.
CustomModifiers
.
Length
,
this
.
RefKind
));
}
AddSynthesizedAttribute
(
ref
attributes
,
compilation
.
SynthesizeDynamicAttribute
(
this
.
Type
,
this
.
CustomModifiers
.
Length
,
this
.
RefKind
));
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录