Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
dotNET Platform
fsharp
提交
478dfd76
F
fsharp
项目概览
dotNET Platform
/
fsharp
12 个月 前同步成功
通知
0
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
F
fsharp
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
478dfd76
编写于
1月 18, 2018
作者:
K
Kevin Ransom (msft)
提交者:
GitHub
1月 18, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Set serializable bit for all serializable types (#4211)
上级
5a12cde1
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
11 addition
and
16 deletion
+11
-16
src/fsharp/IlxGen.fs
src/fsharp/IlxGen.fs
+10
-12
src/fsharp/TcGlobals.fs
src/fsharp/TcGlobals.fs
+0
-1
src/fsharp/fsc.fs
src/fsharp/fsc.fs
+1
-3
未找到文件。
src/fsharp/IlxGen.fs
浏览文件 @
478dfd76
...
...
@@ -3747,8 +3747,8 @@ and GenClosureTypeDefs cenv (tref:ILTypeRef, ilGenParams, attrs, ilCloFreeVars,
Properties
=
emptyILProperties
Methods
=
mkILMethods
mdefs
MethodImpls
=
mkILMethodImpls
mimpls
IsSerializable
=
cenv
.
g
.
attrib_SerializableAttribute
.
IsSom
e
IsComInterop
=
false
IsSerializable
=
tru
e
IsComInterop
=
false
IsSpecialName
=
true
NestedTypes
=
emptyILTypeDefs
Encoding
=
ILDefaultPInvokeEncoding
.
Auto
...
...
@@ -3803,8 +3803,8 @@ and GenLambdaClosure cenv (cgbuf:CodeGenBuffer) eenv isLocalTypeFunc selfv expr
Properties
=
emptyILProperties
Methods
=
mkILMethods
ilContractMeths
MethodImpls
=
emptyILMethodImpls
IsSerializable
=
cenv
.
g
.
attrib_SerializableAttribute
.
IsSome
IsComInterop
=
false
IsSerializable
=
true
IsComInterop
=
false
IsSpecialName
=
true
NestedTypes
=
emptyILTypeDefs
Encoding
=
ILDefaultPInvokeEncoding
.
Auto
...
...
@@ -6563,9 +6563,8 @@ and GenTypeDef cenv mgbuf lazyInitInfo eenv m (tycon:Tycon) =
let
ilFields
=
mkILFields
ilFieldDefs
let
tdef
,
tdefDiscards
=
let
isSerializable
=
(
TryFindFSharpBoolAttribute
cenv
.
g
cenv
.
g
.
attrib_AutoSerializableAttribute
tycon
.
Attribs
<>
Some
(
false
))
&&
cenv
.
g
.
attrib_SerializableAttribute
.
IsSome
let
isSerializable
=
(
TryFindFSharpBoolAttribute
cenv
.
g
cenv
.
g
.
attrib_AutoSerializableAttribute
tycon
.
Attribs
<>
Some
(
false
))
match
tycon
.
TypeReprInfo
with
|
TILObjectRepr
_
->
let
td
=
tycon
.
ILTyconRawMetadata
...
...
@@ -6817,11 +6816,10 @@ and GenExnDef cenv mgbuf eenv m (exnc:Tycon) =
else
[]
let
serializationRelatedMembers
=
// do not emit serialization related members if target framework lacks SerializableAttribute or SerializationInfo
match
cenv
.
g
.
attrib_SerializableAttribute
,
cenv
.
g
.
iltyp_SerializationInfo
,
cenv
.
g
.
iltyp_StreamingContext
with
|
Some
_,
Some
serializationInfoType
,
Some
streamingContextType
->
// do not emit serialization related members if target framework lacks SerializationInfo or StreamingContext
match
cenv
.
g
.
iltyp_SerializationInfo
,
cenv
.
g
.
iltyp_StreamingContext
with
|
Some
serializationInfoType
,
Some
streamingContextType
->
let
ilCtorDefForSerialziation
=
mkILCtor
(
ILMemberAccess
.
Family
,
[
mkILParamNamed
(
"info"
,
serializationInfoType
);
mkILParamNamed
(
"context"
,
streamingContextType
)],
...
...
@@ -6880,7 +6878,7 @@ and GenExnDef cenv mgbuf eenv m (exnc:Tycon) =
emptyILEvents
,
mkILCustomAttrs
[
mkCompilationMappingAttr
cenv
.
g
(
int
SourceConstructFlags
.
Exception
)],
ILTypeInit
.
BeforeField
)
let
tdef
=
{
tdef
with
IsSerializable
=
cenv
.
g
.
attrib_SerializableAttribute
.
IsSom
e
}
let
tdef
=
{
tdef
with
IsSerializable
=
tru
e
}
mgbuf
.
AddTypeDef
(
tref
,
tdef
,
false
,
false
,
None
)
...
...
src/fsharp/TcGlobals.fs
浏览文件 @
478dfd76
...
...
@@ -1005,7 +1005,6 @@ type public TcGlobals(compilingFslib: bool, ilg:ILGlobals, fslibCcu: CcuThunk, d
member
val
attrib_ProjectionParameterAttribute
=
mk_MFCore_attrib
"ProjectionParameterAttribute"
member
val
attrib_CustomOperationAttribute
=
mk_MFCore_attrib
"CustomOperationAttribute"
member
val
attrib_NonSerializedAttribute
=
tryFindSysAttrib
"System.NonSerializedAttribute"
member
val
attrib_SerializableAttribute
=
tryFindSysAttrib
"System.SerializableAttribute"
member
val
attrib_AutoSerializableAttribute
=
mk_MFCore_attrib
"AutoSerializableAttribute"
member
val
attrib_RequireQualifiedAccessAttribute
=
mk_MFCore_attrib
"RequireQualifiedAccessAttribute"
...
...
src/fsharp/fsc.fs
浏览文件 @
478dfd76
...
...
@@ -1968,12 +1968,10 @@ let main2b (tcImportsCapture,dynamicAssemblyCreator) (Args (ctok, tcConfig: TcCo
use
unwindBuildPhase
=
PushThreadBuildPhaseUntilUnwind
BuildPhase
.
IlxGen
let
ilxGenerator
=
CreateIlxAssemblyGenerator
(
tcConfig
,
tcImports
,
tcGlobals
,
(
LightweightTcValForUsingInBuildMethodCall
tcGlobals
),
generatedCcu
)
// Check if System.SerializableAttribute exists in mscorlib.dll,
// so that make sure the compiler only emits "serializable" bit into IL metadata when it is available.
// Note that SerializableAttribute may be relocated in the future but now resides in mscorlib.
let
codegenResults
=
GenerateIlxCode
((
if
Option
.
isSome
dynamicAssemblyCreator
then
IlReflectBackend
else
IlWriteBackend
),
Option
.
isSome
dynamicAssemblyCreator
,
false
,
tcConfig
,
topAttrs
,
optimizedImpls
,
generatedCcu
.
AssemblyName
,
ilxGenerator
)
let
casApplied
=
new
Dictionary
<
Stamp
,
bool
>()
let
securityAttrs
,
topAssemblyAttrs
=
topAttrs
.
assemblyAttrs
|>
List
.
partition
(
fun
a
->
TypeChecker
.
IsSecurityAttribute
tcGlobals
(
tcImports
.
GetImportMap
()
)
casApplied
a
rangeStartup
)
// remove any security attributes from the top-level assembly attribute list
let
topAttrs
=
{
topAttrs
with
assemblyAttrs
=
topAssemblyAttrs
}
let
permissionSets
=
ilxGenerator
.
CreatePermissionSets
securityAttrs
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录