mirror of
https://github.com/Smaug123/WoofWare.PawPrint
synced 2025-10-06 22:48:41 +00:00
Split WoofWare.PawPrint.Domain into a new subtree (#41)
This commit is contained in:
@@ -458,7 +458,7 @@ module Assembly =
|
||||
| Some ty -> resolveTypeFromExport assy assemblies ty genericArgs
|
||||
| k -> failwith $"Unexpected: {k}"
|
||||
|
||||
and internal resolveTypeFromName
|
||||
and resolveTypeFromName
|
||||
(assy : DumpedAssembly)
|
||||
(assemblies : ImmutableDictionary<string, DumpedAssembly>)
|
||||
(ns : string option)
|
@@ -6,6 +6,14 @@ open System.Reflection.Metadata
|
||||
|
||||
type FakeUnit = private | FakeUnit
|
||||
|
||||
[<RequireQualifiedAccess>]
|
||||
module FakeUnit =
|
||||
let ofUnit () = FakeUnit.FakeUnit
|
||||
|
||||
let toUnit (f : FakeUnit) =
|
||||
match f with
|
||||
| FakeUnit.FakeUnit -> ()
|
||||
|
||||
/// A type which has been concretised, runtime-representable, etc.
|
||||
[<CustomEquality>]
|
||||
[<CustomComparison>]
|
@@ -8,6 +8,7 @@ open System.Reflection.PortableExecutable
|
||||
open Microsoft.Extensions.Logging
|
||||
open Microsoft.FSharp.Core
|
||||
|
||||
[<RequireQualifiedAccess>]
|
||||
type BaseTypeInfo =
|
||||
| TypeDef of TypeDefinitionHandle
|
||||
| TypeRef of TypeReferenceHandle
|
35
WoofWare.PawPrint.Domain/WoofWare.PawPrint.Domain.fsproj
Normal file
35
WoofWare.PawPrint.Domain/WoofWare.PawPrint.Domain.fsproj
Normal file
@@ -0,0 +1,35 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Include="StringToken.fs" />
|
||||
<Compile Include="Tokens.fs" />
|
||||
<Compile Include="TypeRef.fs" />
|
||||
<Compile Include="IlOp.fs" />
|
||||
<Compile Include="CustomAttribute.fs" />
|
||||
<Compile Include="AssemblyReference.fs" />
|
||||
<Compile Include="EventDefn.fs" />
|
||||
<Compile Include="ComparableTypeDefinitionHandle.fs" />
|
||||
<Compile Include="ComparableSignatureHeader.fs" />
|
||||
<Compile Include="TypeDefn.fs" />
|
||||
<Compile Include="ConcreteType.fs" />
|
||||
<Compile Include="FieldInfo.fs" />
|
||||
<Compile Include="MethodInfo.fs" />
|
||||
<Compile Include="TypeInfo.fs" />
|
||||
<Compile Include="MethodSpec.fs" />
|
||||
<Compile Include="MemberReference.fs" />
|
||||
<Compile Include="Namespace.fs" />
|
||||
<Compile Include="ExportedType.fs" />
|
||||
<Compile Include="TypeSpec.fs" />
|
||||
<Compile Include="Assembly.fs" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="9.0.2" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
@@ -11,6 +11,8 @@ Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "HelloWorld", "HelloWorld\He
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CSharpExample", "CSharpExample\CSharpExample.csproj", "{250EF9D0-7C29-4AFF-844B-13CC68962B21}"
|
||||
EndProject
|
||||
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "WoofWare.PawPrint.Domain", "WoofWare.PawPrint.Domain\WoofWare.PawPrint.Domain.fsproj", "{9C1B1150-F1B6-46FA-A2DC-644CC5052C60}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@@ -37,5 +39,9 @@ Global
|
||||
{250EF9D0-7C29-4AFF-844B-13CC68962B21}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{250EF9D0-7C29-4AFF-844B-13CC68962B21}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{250EF9D0-7C29-4AFF-844B-13CC68962B21}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{9C1B1150-F1B6-46FA-A2DC-644CC5052C60}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{9C1B1150-F1B6-46FA-A2DC-644CC5052C60}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{9C1B1150-F1B6-46FA-A2DC-644CC5052C60}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{9C1B1150-F1B6-46FA-A2DC-644CC5052C60}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
@@ -1,7 +1,6 @@
|
||||
namespace WoofWare.PawPrint
|
||||
|
||||
open System.Collections.Immutable
|
||||
open System.Reflection.Metadata
|
||||
|
||||
/// Represents a location in the code where an exception occurred
|
||||
type ExceptionStackFrame =
|
||||
|
@@ -29,7 +29,7 @@ type IlMachineState =
|
||||
|
||||
member this.SetStatic (ty : RuntimeConcreteType) (field : string) (value : CliType) : IlMachineState =
|
||||
// Static variables are shared among all instantiations of a generic type.
|
||||
let ty = ty |> ConcreteType.mapGeneric (fun _ _ -> FakeUnit.FakeUnit)
|
||||
let ty = ty |> ConcreteType.mapGeneric (fun _ _ -> FakeUnit.ofUnit ())
|
||||
|
||||
let statics =
|
||||
match this._Statics.TryGetValue ty with
|
||||
@@ -42,7 +42,7 @@ type IlMachineState =
|
||||
|
||||
member this.GetStatic (ty : RuntimeConcreteType) (field : string) : CliType option =
|
||||
// Static variables are shared among all instantiations of a generic type.
|
||||
let ty = ty |> ConcreteType.mapGeneric (fun _ _ -> FakeUnit.FakeUnit)
|
||||
let ty = ty |> ConcreteType.mapGeneric (fun _ _ -> FakeUnit.ofUnit ())
|
||||
|
||||
match this._Statics.TryGetValue ty with
|
||||
| false, _ -> None
|
||||
@@ -601,7 +601,7 @@ module IlMachineState =
|
||||
| Some baseTypeInfo ->
|
||||
// Determine if base type is in the same or different assembly
|
||||
match baseTypeInfo with
|
||||
| ForeignAssemblyType _ -> failwith "TODO"
|
||||
| BaseTypeInfo.ForeignAssemblyType _ -> failwith "TODO"
|
||||
//logger.LogDebug (
|
||||
// "Resolved base type of {TypeDefNamespace}.{TypeDefName} to foreign assembly {ForeignAssemblyName}",
|
||||
// typeDef.Namespace,
|
||||
@@ -612,7 +612,7 @@ module IlMachineState =
|
||||
//match loadClass loggerFactory baseTypeHandle baseAssemblyName currentThread state with
|
||||
//| FirstLoadThis state -> Error state
|
||||
//| NothingToDo state -> Ok state
|
||||
| TypeDef typeDefinitionHandle ->
|
||||
| BaseTypeInfo.TypeDef typeDefinitionHandle ->
|
||||
logger.LogDebug (
|
||||
"Resolved base type of {TypeDefNamespace}.{TypeDefName} to this assembly, typedef",
|
||||
typeDef.Namespace,
|
||||
@@ -625,7 +625,7 @@ module IlMachineState =
|
||||
match loadClass loggerFactory corelib ty currentThread state with
|
||||
| FirstLoadThis state -> Error state
|
||||
| NothingToDo state -> Ok state
|
||||
| TypeRef typeReferenceHandle ->
|
||||
| BaseTypeInfo.TypeRef typeReferenceHandle ->
|
||||
let state, assy, targetType =
|
||||
// TypeRef won't have any generics; it would be a TypeSpec if it did
|
||||
resolveType
|
||||
@@ -649,7 +649,8 @@ module IlMachineState =
|
||||
match loadClass loggerFactory corelib ty currentThread state with
|
||||
| FirstLoadThis state -> Error state
|
||||
| NothingToDo state -> Ok state
|
||||
| TypeSpec typeSpecificationHandle -> failwith "TODO: TypeSpec base type loading unimplemented"
|
||||
| BaseTypeInfo.TypeSpec typeSpecificationHandle ->
|
||||
failwith "TODO: TypeSpec base type loading unimplemented"
|
||||
| None -> Ok state // No base type (or it's System.Object)
|
||||
|
||||
match firstDoBaseClass with
|
||||
|
@@ -1,8 +1,6 @@
|
||||
namespace WoofWare.PawPrint
|
||||
|
||||
open System.Collections.Immutable
|
||||
open System.Reflection
|
||||
open System.Reflection.Metadata
|
||||
|
||||
/// Represents the state of a type's initialization in the CLI
|
||||
type TypeInitState =
|
||||
|
@@ -8,26 +8,6 @@
|
||||
<ItemGroup>
|
||||
<Compile Include="Tuple.fs" />
|
||||
<Compile Include="Result.fs" />
|
||||
<Compile Include="StringToken.fs" />
|
||||
<Compile Include="Tokens.fs" />
|
||||
<Compile Include="TypeRef.fs" />
|
||||
<Compile Include="IlOp.fs" />
|
||||
<Compile Include="CustomAttribute.fs" />
|
||||
<Compile Include="AssemblyReference.fs" />
|
||||
<Compile Include="EventDefn.fs" />
|
||||
<Compile Include="ComparableTypeDefinitionHandle.fs" />
|
||||
<Compile Include="ComparableSignatureHeader.fs" />
|
||||
<Compile Include="TypeDefn.fs" />
|
||||
<Compile Include="ConcreteType.fs" />
|
||||
<Compile Include="FieldInfo.fs" />
|
||||
<Compile Include="MethodInfo.fs" />
|
||||
<Compile Include="TypeInfo.fs" />
|
||||
<Compile Include="MethodSpec.fs" />
|
||||
<Compile Include="MemberReference.fs" />
|
||||
<Compile Include="Namespace.fs" />
|
||||
<Compile Include="ExportedType.fs" />
|
||||
<Compile Include="TypeSpec.fs" />
|
||||
<Compile Include="Assembly.fs" />
|
||||
<Compile Include="Corelib.fs" />
|
||||
<Compile Include="AbstractMachineDomain.fs" />
|
||||
<Compile Include="BasicCliType.fs" />
|
||||
@@ -70,4 +50,8 @@
|
||||
<ItemGroup>
|
||||
<MyriadSdkGenerator Include="$(NuGetPackageRoot)/woofware.myriad.plugins/$(WoofWareMyriadPluginsVersion)/lib/net6.0/WoofWare.Myriad.Plugins.dll" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\WoofWare.PawPrint.Domain\WoofWare.PawPrint.Domain.fsproj" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
Reference in New Issue
Block a user