@@ -3206,50 +3206,50 @@ and seekReadManifestResources ctxt () =
32063206yield r])
32073207
32083208
3209- and seekReadNestedExportedTypes ctxt parentIdx =
3209+ and seekReadNestedExportedTypes ctxt ( exported : _ array ) ( nested : Lazy < _ array >) parentIdx =
32103210 mkILNestedExportedTypesLazy
32113211( lazy
3212- [ for i= 1 to ctxt.getNumRows TableNames.ExportedTypedo
3213- let ( flags , _tok , nameIdx , namespaceIdx , implIdx ) = seekReadExportedTypeRow ctxt i
3214- if not ( isTopTypeDef flags) then
3215- let ( TaggedIndex ( tag , idx ) ) = implIdx
3216- //let isTopTypeDef = (idx = 0 || tag <> i_ExportedType)
3217- //if not isTopTypeDef then
3218- match tagwith
3219- | tagwhen tag= i_ ExportedType&& idx= parentIdx->
3220- let nm = readBlobHeapAsTypeName ctxt( nameIdx, namespaceIdx)
3221- yield
3222- { Name= nm
3223- Access=( match typeAccessOfFlags flagswith ILTypeDefAccess.Nested n-> n| _ -> failwith" non-nested access for a nested type described as being in an auxiliary module" )
3224- Nested= seekReadNestedExportedTypes ctxt i
3225- CustomAttrs= seekReadCustomAttrs ctxt( TaggedIndex( hca_ ExportedType, i)) }
3226- | _ -> () ])
3227-
3212+ nested.Force().[ parentIdx-1 ]
3213+ |> List.map( fun i ->
3214+ let ( flags , _tok , nameIdx , namespaceIdx , _implIdx ) = exported.[ i-1 ]
3215+ { Name= readBlobHeapAsTypeName ctxt( nameIdx, namespaceIdx)
3216+ Access= ( match typeAccessOfFlags flagswith
3217+ | ILTypeDefAccess.Nested n-> n
3218+ | _ -> failwith" non-nested access for a nested type described as being in an auxiliary module" )
3219+ Nested= seekReadNestedExportedTypes ctxt exported nested i
3220+ CustomAttrs= seekReadCustomAttrs ctxt( TaggedIndex( hca_ ExportedType, i)) }
3221+ ))
3222+
32283223and seekReadTopExportedTypes ctxt () =
32293224 mkILExportedTypesLazy
32303225( lazy
3231- let res = ref[]
3232- for i= 1 to ctxt.getNumRows TableNames.ExportedTypedo
3233- let ( flags , _tok , nameIdx , namespaceIdx , implIdx ) = seekReadExportedTypeRow ctxt i
3234- if isTopTypeDef flagsthen
3235- let ( TaggedIndex ( tag , _idx ) ) = implIdx
3236-
3237- // the nested types will be picked up by their enclosing types
3238- if tag<> i_ ExportedTypethen
3239- let nm = readBlobHeapAsTypeName ctxt( nameIdx, namespaceIdx)
3240-
3241- let scoref = seekReadImplAsScopeRef ctxt implIdx
3242-
3243- let entry =
3244- { ScopeRef= scoref
3245- Name= nm
3246- IsForwarder= (( flags&&& 0x00200000 ) <> 0 )
3247- Access= typeAccessOfFlags flags
3248- Nested= seekReadNestedExportedTypes ctxt i
3249- CustomAttrs= seekReadCustomAttrs ctxt( TaggedIndex( hca_ ExportedType, i)) }
3250- res:= entry:: ! res
3251- done
3252- List.rev! res)
3226+ let numRows = ctxt.getNumRows TableNames.ExportedType
3227+ let exported = [| for iin 1 .. numRows-> seekReadExportedTypeRow ctxt i|]
3228+
3229+ // add each nested type id to their parent's children list
3230+ let nested = lazy (
3231+ let nested = [| for _ iin 1 .. numRows-> [] |]
3232+ for i= 1 to numRowsdo
3233+ let ( flags , _ , _ , _ , TaggedIndex ( tag , idx )) = exported.[ i-1 ]
3234+ if not ( isTopTypeDef flags) && ( tag= i_ ExportedType) then
3235+ nested.[ idx-1 ] <- i:: nested.[ idx-1 ]
3236+ nested)
3237+
3238+ // return top exported types
3239+ [ for i= 1 to numRowsdo
3240+ let ( flags , _tok , nameIdx , namespaceIdx , implIdx ) = exported.[ i-1 ]
3241+ let ( TaggedIndex ( tag , _idx )) = implIdx
3242+
3243+ // if not a nested type
3244+ if ( isTopTypeDef flags) && ( tag<> i_ ExportedType) then
3245+ yield
3246+ { ScopeRef= seekReadImplAsScopeRef ctxt implIdx
3247+ Name= readBlobHeapAsTypeName ctxt( nameIdx, namespaceIdx)
3248+ IsForwarder= (( flags&&& 0x00200000 ) <> 0 )
3249+ Access= typeAccessOfFlags flags
3250+ Nested= seekReadNestedExportedTypes ctxt exported nested i
3251+ CustomAttrs= seekReadCustomAttrs ctxt( TaggedIndex( hca_ ExportedType, i)) }
3252+ ])
32533253
32543254#if ! FX_ NO_ PDB_ READER
32553255let getPdbReader opts infile =