More corelib (#76)

This commit is contained in:
Patrick Stevens
2025-06-30 22:15:33 +01:00
committed by GitHub
parent 711bfd5aad
commit ddd6374c72
3 changed files with 30 additions and 0 deletions

View File

@@ -81,7 +81,9 @@ dotnet publish --self-contained --runtime-id osx-arm64 CSharpExample/ && dotnet
* Functions should be fully type-annotated, to give the most helpful error messages on type mismatches.
* Generally, prefer to fully-qualify discriminated union cases in `match` statements.
* ALWAYS fully-qualify enum cases when constructing them and matching on them (e.g., `PrimitiveType.Int16` not `Int16`).
* When writing a "TODO" `failwith`, specify in the error message what the condition is that triggers the failure, so that a failing run can easily be traced back to its cause.
* If a field name begins with an underscore (like `_LoadedAssemblies`), do not mutate it directly. Only mutate it via whatever intermediate methods have been defined for that purpose (like `WithLoadedAssembly`).
### Development Workflow

View File

@@ -141,6 +141,10 @@ type BaseClassTypes<'corelib> =
RuntimeFieldHandle : TypeInfo<WoofWare.PawPrint.GenericParameter>
RuntimeTypeHandle : TypeInfo<WoofWare.PawPrint.GenericParameter>
RuntimeType : TypeInfo<WoofWare.PawPrint.GenericParameter>
Void : TypeInfo<WoofWare.PawPrint.GenericParameter>
TypedReference : TypeInfo<WoofWare.PawPrint.GenericParameter>
IntPtr : TypeInfo<WoofWare.PawPrint.GenericParameter>
UIntPtr : TypeInfo<WoofWare.PawPrint.GenericParameter>
}
[<RequireQualifiedAccess>]

View File

@@ -114,6 +114,26 @@ module Corelib =
|> Seq.choose (fun (KeyValue (_, v)) -> if v.Name = "RuntimeFieldHandle" then Some v else None)
|> Seq.exactlyOne
let voidType =
corelib.TypeDefs
|> Seq.choose (fun (KeyValue (_, v)) -> if v.Name = "Void" then Some v else None)
|> Seq.exactlyOne
let typedReferenceType =
corelib.TypeDefs
|> Seq.choose (fun (KeyValue (_, v)) -> if v.Name = "TypedReference" then Some v else None)
|> Seq.exactlyOne
let intPtrType =
corelib.TypeDefs
|> Seq.choose (fun (KeyValue (_, v)) -> if v.Name = "IntPtr" then Some v else None)
|> Seq.exactlyOne
let uintPtrType =
corelib.TypeDefs
|> Seq.choose (fun (KeyValue (_, v)) -> if v.Name = "UIntPtr" then Some v else None)
|> Seq.exactlyOne
{
Corelib = corelib
String = stringType
@@ -138,4 +158,8 @@ module Corelib =
RuntimeMethodHandle = runtimeMethodHandleType
RuntimeFieldHandle = runtimeFieldHandleType
RuntimeType = runtimeTypeType
Void = voidType
TypedReference = typedReferenceType
IntPtr = intPtrType
UIntPtr = uintPtrType
}