@@ -1909,6 +1909,23 @@ let inline conditionalAdd condition flagToAdd source =
19091909
19101910let NoMetadataIdx = - 1
19111911
1912+ type InterfaceImpl =
1913+ { Idx: int ; Type: ILType ; mutable CustomAttrsStored: ILAttributesStored }
1914+
1915+ member x.CustomAttrs =
1916+ match x.CustomAttrsStored with
1917+ | ILAttributesStored.Reader f ->
1918+ let res = ILAttributes( f x.Idx)
1919+ x.CustomAttrsStored <- ILAttributesStored.Given res
1920+ res
1921+ | ILAttributesStored.Given attrs -> attrs
1922+
1923+ static member Create ( ilType : ILType , customAttrsStored : ILAttributesStored ) =
1924+ { Idx = NoMetadataIdx; Type = ilType; CustomAttrsStored = customAttrsStored }
1925+
1926+ static member Create ( ilType : ILType ) = InterfaceImpl.Create( ilType, emptyILCustomAttrsStored)
1927+
1928+
19121929[<NoComparison; NoEquality; StructuredFormatDisplay( " {DebugText}" ) >]
19131930type ILMethodDef
19141931 (
@@ -2635,8 +2652,7 @@ type ILTypeDef
26352652 name: string,
26362653 attributes: TypeAttributes,
26372654 layout: ILTypeDefLayout,
2638- implements: ILTypes,
2639- implementsCustomAttrs: ( ILAttributesStored * int) list option,
2655+ implements: InterruptibleLazy< InterfaceImpl list>,
26402656 genericParams: ILGenericParameterDefs,
26412657 extends: ILType option,
26422658 methods: ILMethodDefs,
@@ -2659,7 +2675,6 @@ type ILTypeDef
26592675 attributes,
26602676 layout,
26612677 implements,
2662- implementsCustomAttrs,
26632678 genericParams,
26642679 extends,
26652680 methods,
@@ -2676,7 +2691,6 @@ type ILTypeDef
26762691 attributes,
26772692 layout,
26782693 implements,
2679- implementsCustomAttrs,
26802694 genericParams,
26812695 extends,
26822696 methods,
@@ -2703,8 +2717,6 @@ type ILTypeDef
27032717
27042718 member _.Implements = implements
27052719
2706- member _.ImplementsCustomAttrs = implementsCustomAttrs
2707-
27082720 member _.Extends = extends
27092721
27102722 member _.Methods = methods
@@ -2744,8 +2756,7 @@ type ILTypeDef
27442756 ? properties ,
27452757 ? newAdditionalFlags ,
27462758 ? customAttrs ,
2747- ? securityDecls ,
2748- ? implementsCustomAttrs
2759+ ? securityDecls
27492760 ) =
27502761 ILTypeDef(
27512762 name = defaultArg name x.Name,
@@ -2754,7 +2765,6 @@ type ILTypeDef
27542765 genericParams = defaultArg genericParams x.GenericParams,
27552766 nestedTypes = defaultArg nestedTypes x.NestedTypes,
27562767 implements = defaultArg implements x.Implements,
2757- implementsCustomAttrs = defaultArg implementsCustomAttrs x.ImplementsCustomAttrs,
27582768 extends = defaultArg extends x.Extends,
27592769 methods = defaultArg methods x.Methods,
27602770 securityDecls = defaultArg securityDecls x.SecurityDecls,
@@ -3333,6 +3343,8 @@ let mkILTypeDefs l = mkILTypeDefsFromArray (Array.ofList l)
33333343let mkILTypeDefsComputed f = ILTypeDefs f
33343344let emptyILTypeDefs = mkILTypeDefsFromArray [||]
33353345
3346+ let emptyILInterfaceImpls = InterruptibleLazy< InterfaceImpl list>. FromValue([])
3347+
33363348// --------------------------------------------------------------------
33373349// Operations on method tables.
33383350// --------------------------------------------------------------------
@@ -4240,7 +4252,7 @@ let mkILSimpleStorageCtor (baseTySpec, ty, extraParams, flds, access, tag, impor
42404252let mkILStorageCtor ( preblock , ty , flds , access , tag , imports ) =
42414253 mkILStorageCtorWithParamNames ( preblock, ty, [], addParamNames flds, access, tag, imports)
42424254
4243- let mkILGenericClass ( nm , access , genparams , extends , impl , methods , fields , nestedTypes , props , events , attrs , init ) =
4255+ let mkILGenericClass ( nm , access , genparams , extends , impls , methods , fields , nestedTypes , props , events , attrs , init ) =
42444256 let attributes =
42454257 convertTypeAccessFlags access
42464258 ||| TypeAttributes.AutoLayout
@@ -4254,8 +4266,7 @@ let mkILGenericClass (nm, access, genparams, extends, impl, methods, fields, nes
42544266 name = nm,
42554267 attributes = attributes,
42564268 genericParams = genparams,
4257- implements = impl,
4258- implementsCustomAttrs = None,
4269+ implements = InterruptibleLazy.FromValue( impls),
42594270 layout = ILTypeDefLayout.Auto,
42604271 extends = Some extends,
42614272 methods = methods,
@@ -4279,8 +4290,7 @@ let mkRawDataValueTypeDef (iltyp_ValueType: ILType) (nm, size, pack) =
42794290 ||| TypeAttributes.ExplicitLayout
42804291 ||| TypeAttributes.BeforeFieldInit
42814292 ||| TypeAttributes.AnsiClass),
4282- implements = [],
4283- implementsCustomAttrs = None,
4293+ implements = emptyILInterfaceImpls,
42844294 extends = Some iltyp_ ValueType,
42854295 layout = ILTypeDefLayout.Explicit { Size = Some size; Pack = Some pack },
42864296 methods = emptyILMethods,
@@ -5586,7 +5596,7 @@ and refsOfILMethodImpl s m =
55865596and refsOfILTypeDef s ( td : ILTypeDef ) =
55875597 refsOfILTypeDefs s td.NestedTypes
55885598 refsOfILGenericParams s td.GenericParams
5589- refsOfILTypes s td.Implements
5599+ refsOfILTypes s ( td.Implements.Value |> List.map _. Type )
55905600 Option.iter ( refsOfILType s) td.Extends
55915601 refsOfILMethodDefs s td.Methods
55925602 refsOfILFieldDefs s ( td.Fields.AsList())
0 commit comments