提交 406c9d62 编写于 作者: K Kevin Ransom 提交者: Kevin Ransom

refactor

上级 c0de51dd
......@@ -1558,8 +1558,7 @@ type ILFieldDef =
member x.WithStatic(condition) = { x with Attributes = x.Attributes |> conditionalAdd condition FieldAttributes.Static }
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.WithLiteral(condition) = { x with Attributes = x.Attributes |> conditionalAdd condition FieldAttributes.Literal }
member x.WithHasDefault(condition) = { x with Attributes = x.Attributes |> conditionalAdd condition FieldAttributes.HasDefault }
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 }
......
......@@ -1138,8 +1138,7 @@ type ILFieldDef =
member WithStatic: bool -> ILFieldDef
member WithSpecialName: bool -> ILFieldDef
member WithNotSerialized: bool -> ILFieldDef
member WithLiteral: bool -> ILFieldDef
member WithHasDefault: bool -> ILFieldDef
member WithLiteralDefaultValue: ILFieldInit option -> ILFieldDef
member WithHasFieldMarshal: bool -> ILFieldDef
/// Tables of fields. Logically equivalent to a list of fields but
......
......@@ -4742,7 +4742,7 @@ and GenBindingAfterSequencePoint cenv cgbuf eenv sp (TBind(vspec,rhsExpr,_)) sta
let ilFieldDef = mkILStaticField (fspec.Name, fty, None, None, access)
let ilFieldDef =
match vref.LiteralValue with
| Some konst -> { (ilFieldDef.WithHasDefault(true)).WithLiteral(true) with LiteralValue = Some(GenFieldInit m konst) }
| Some konst -> ilFieldDef.WithLiteralDefaultValue( Some (GenFieldInit m konst) )
| None -> ilFieldDef
let ilFieldDef =
......@@ -6348,7 +6348,7 @@ and GenTypeDef cenv mgbuf lazyInitInfo eenv m (tycon:Tycon) =
Type = ilPropType
Attributes = enum 0
Data = None
LiteralValue = literalValue
LiteralValue = None
Offset = ilFieldOffset
Marshal = ilFieldMarshal
CustomAttrs = mkILCustomAttrs (GenAttrs cenv eenv fattribs @ extraAttribs) }
......@@ -6357,8 +6357,7 @@ and GenTypeDef cenv mgbuf lazyInitInfo eenv m (tycon:Tycon) =
.WithStatic(isStatic)
.WithSpecialName(ilFieldName="value__" && tycon.IsEnumTycon)
.WithNotSerialized(ilNotSerialized)
.WithLiteral(fspec.LiteralValue.IsSome)
.WithHasDefault(literalValue.IsSome)
.WithLiteralDefaultValue(literalValue)
.WithHasFieldMarshal(ilFieldMarshal.IsSome)
yield fdef
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册