mirror of
https://github.com/Smaug123/WoofWare.PawPrint
synced 2025-10-12 17:18:40 +00:00
Fix argument ordering bug (#58)
This commit is contained in:
@@ -244,6 +244,7 @@ type DumpedAssembly =
|
||||
interface IDisposable with
|
||||
member this.Dispose () = this.PeReader.Dispose ()
|
||||
|
||||
|
||||
type TypeResolutionResult =
|
||||
| FirstLoadAssy of WoofWare.PawPrint.AssemblyReference
|
||||
| Resolved of DumpedAssembly * TypeInfo<TypeDefn>
|
||||
@@ -516,3 +517,46 @@ module Assembly =
|
||||
match assemblies.TryGetValue assy.Name.FullName with
|
||||
| false, _ -> TypeResolutionResult.FirstLoadAssy assy
|
||||
| true, toAssy -> resolveTypeFromName toAssy assemblies ty.Namespace ty.Name genericArgs
|
||||
|
||||
[<RequireQualifiedAccess>]
|
||||
module DumpedAssembly =
|
||||
let resolveBaseType
|
||||
(bct : BaseClassTypes<DumpedAssembly>)
|
||||
(loadedAssemblies : ImmutableDictionary<string, DumpedAssembly>)
|
||||
(source : AssemblyName)
|
||||
(baseTypeInfo : BaseTypeInfo option)
|
||||
: ResolvedBaseType
|
||||
=
|
||||
let rec go (baseType : BaseTypeInfo option) =
|
||||
match baseType with
|
||||
| Some (BaseTypeInfo.TypeRef r) ->
|
||||
let assy = loadedAssemblies.[source.FullName]
|
||||
// TODO: generics
|
||||
match Assembly.resolveTypeRef loadedAssemblies assy assy.TypeRefs.[r] None with
|
||||
| TypeResolutionResult.FirstLoadAssy _ ->
|
||||
failwith
|
||||
"seems pretty unlikely that we could have constructed this object without loading its base type"
|
||||
| TypeResolutionResult.Resolved (assy, typeInfo) ->
|
||||
match TypeInfo.isBaseType bct _.Name assy.Name typeInfo.TypeDefHandle with
|
||||
| Some v -> v
|
||||
| None -> go typeInfo.BaseType
|
||||
| Some (BaseTypeInfo.ForeignAssemblyType (assy, ty)) ->
|
||||
let assy = loadedAssemblies.[assy.FullName]
|
||||
|
||||
match TypeInfo.isBaseType bct _.Name assy.Name ty with
|
||||
| Some v -> v
|
||||
| None ->
|
||||
let ty = assy.TypeDefs.[ty]
|
||||
go ty.BaseType
|
||||
| Some (BaseTypeInfo.TypeSpec _) -> failwith "TODO"
|
||||
| Some (BaseTypeInfo.TypeDef h) ->
|
||||
let assy = loadedAssemblies.[source.FullName]
|
||||
|
||||
match TypeInfo.isBaseType bct _.Name assy.Name h with
|
||||
| Some v -> v
|
||||
| None ->
|
||||
let ty = assy.TypeDefs.[h]
|
||||
go ty.BaseType
|
||||
| None -> ResolvedBaseType.Object
|
||||
|
||||
go baseTypeInfo
|
||||
|
Reference in New Issue
Block a user