Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
DedSec256 committed Jun 21, 2024
1 parent 6a30813 commit 860b97a
Showing 1 changed file with 26 additions and 23 deletions.
49 changes: 26 additions & 23 deletions src/Compiler/AbstractIL/ilread.fs
Original file line number Diff line number Diff line change
Expand Up @@ -2136,34 +2136,37 @@ and typeDefReader ctxtH : ILTypeDefStored =
(isSorted ctxt TableNames.CustomAttribute)
attributesSearcher

let hasAttributes = attrsStartIdx > 0 && attrsEndIdx >= attrsStartIdx
let mutable attrIdx = attrsStartIdx

while hasAttributes && attrIdx <= attrsEndIdx && not containsExtensionMethods do
let mutable attr = Unchecked.defaultof<_>
attributesSearcher.GetRow(attrIdx, &attr)
let attrCtorIdx = attr.typeIndex.index

let name =
if attr.typeIndex.tag = cat_MethodDef then
let idx = seekMethodDefParent ctxt attrCtorIdx
let _, nameIdx, namespaceIdx, _, _, _ = seekReadTypeDefRow ctxt idx
readBlobHeapAsTypeName ctxt (nameIdx, namespaceIdx)
else
let mrpTag, _, _ = seekReadMemberRefRow ctxt mdv attrCtorIdx
if attrsStartIdx <= 0 || attrsEndIdx < attrsStartIdx then
false
else

if mrpTag.tag <> mrp_TypeRef then
""
else
let _, nameIdx, namespaceIdx = seekReadTypeRefRow ctxt mdv mrpTag.index
let mutable attrIdx = attrsStartIdx

while attrIdx <= attrsEndIdx && not containsExtensionMethods do
let mutable attr = Unchecked.defaultof<_>
attributesSearcher.GetRow(attrIdx, &attr)
let attrCtorIdx = attr.typeIndex.index

let name =
if attr.typeIndex.tag = cat_MethodDef then
let idx = seekMethodDefParent ctxt attrCtorIdx
let _, nameIdx, namespaceIdx, _, _, _ = seekReadTypeDefRow ctxt idx
readBlobHeapAsTypeName ctxt (nameIdx, namespaceIdx)
else
let mrpTag, _, _ = seekReadMemberRefRow ctxt mdv attrCtorIdx

if mrpTag.tag <> mrp_TypeRef then
""
else
let _, nameIdx, namespaceIdx = seekReadTypeRefRow ctxt mdv mrpTag.index
readBlobHeapAsTypeName ctxt (nameIdx, namespaceIdx)

if name = "System.Runtime.CompilerServices.ExtensionAttribute" then
containsExtensionMethods <- true
if name = "System.Runtime.CompilerServices.ExtensionAttribute" then
containsExtensionMethods <- true

attrIdx <- attrIdx + 1
attrIdx <- attrIdx + 1

containsExtensionMethods
containsExtensionMethods

let additionalFlags =
if containsExtensionMethods then
Expand Down

0 comments on commit 860b97a

Please sign in to comment.