未验证 提交 cf5afdc9 编写于 作者: A Avi Avni 提交者: GitHub

Merge pull request #26 from forki/literal-value-bug

Use WithFieldMarshal
......@@ -1559,7 +1559,7 @@ type ILFieldDef =
member x.WithSpecialName(condition) = { x with Attributes = x.Attributes |> conditionalAdd condition (FieldAttributes.SpecialName ||| FieldAttributes.RTSpecialName) }
member x.WithNotSerialized(condition) = { x with Attributes = x.Attributes |> conditionalAdd condition FieldAttributes.NotSerialized }
member x.WithLiteralDefaultValue(literal) = { x with LiteralValue = literal; Attributes = x.Attributes |> conditionalAdd literal.IsSome (FieldAttributes.Literal ||| FieldAttributes.HasDefault) }
member x.WithHasFieldMarshal(condition) = { x with Attributes = x.Attributes |> conditionalAdd condition FieldAttributes.HasFieldMarshal }
member x.WithFieldMarshal(marshal) = { x with Marshal = marshal; Attributes = x.Attributes |> conditionalAdd marshal.IsSome FieldAttributes.HasFieldMarshal }
// Index table by name. Keep a canonical list to make sure field order is not disturbed for binary manipulation.
......
......@@ -1139,7 +1139,7 @@ type ILFieldDef =
member WithSpecialName: bool -> ILFieldDef
member WithNotSerialized: bool -> ILFieldDef
member WithLiteralDefaultValue: ILFieldInit option -> ILFieldDef
member WithHasFieldMarshal: bool -> ILFieldDef
member WithFieldMarshal: ILNativeType option -> ILFieldDef
/// Tables of fields. Logically equivalent to a list of fields but
/// the table is kept in a form optimized for looking up fields by
......
......@@ -6350,7 +6350,7 @@ and GenTypeDef cenv mgbuf lazyInitInfo eenv m (tycon:Tycon) =
Data = None
LiteralValue = None
Offset = ilFieldOffset
Marshal = ilFieldMarshal
Marshal = None
CustomAttrs = mkILCustomAttrs (GenAttrs cenv eenv fattribs @ extraAttribs) }
let fdef =
fdef.WithAccess(access)
......@@ -6358,7 +6358,7 @@ and GenTypeDef cenv mgbuf lazyInitInfo eenv m (tycon:Tycon) =
.WithSpecialName(ilFieldName="value__" && tycon.IsEnumTycon)
.WithNotSerialized(ilNotSerialized)
.WithLiteralDefaultValue(literalValue)
.WithHasFieldMarshal(ilFieldMarshal.IsSome)
.WithFieldMarshal(ilFieldMarshal)
yield fdef
if requiresExtraField then
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册