Skip to content

Commit

Permalink
Undo evil formatting.
Browse files Browse the repository at this point in the history
  • Loading branch information
mandel-macaque committed Jan 23, 2025
1 parent 15a79c6 commit 7b433d9
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions src/rgen/Microsoft.Macios.Generator/DataModel/TypeInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -230,26 +230,31 @@ public override int GetHashCode ()
{
var type = this switch {
// special cases based on name
{ Name: "nfloat" or "NFloat" } => "nfloat", { Name: "nint" or "nuint" } => MetadataName,
{ Name: "nfloat" or "NFloat" } => "nfloat",
{ Name: "nint" or "nuint" } => MetadataName,
// special string case
{ SpecialType: SpecialType.System_String } => NativeHandle, // use a NSString when we get a string

// NSObject should use the native handle
{ IsNSObject: true } => NativeHandle, { IsINativeObject: true } => NativeHandle,
{ IsNSObject: true } => NativeHandle,
{ IsINativeObject: true } => NativeHandle,

// structs will use their name
{ IsStruct: true, SpecialType: SpecialType.System_Double } => "Double", { IsStruct: true } => Name,
{ IsStruct: true, SpecialType: SpecialType.System_Double } => "Double",
{ IsStruct: true } => Name,

// enums:
// IsSmartEnum: We are using a nsstring, so it should be a native handle.
// IsNativeEnum: Depends if the enum backing field kind.
// IsNativeEnum: Depends on the enum backing field kind.
// GeneralEnum: Depends on the EnumUnderlyingType

{ IsSmartEnum: true } => NativeHandle, { IsNativeEnum: true, EnumUnderlyingType: SpecialType.System_Int64 } => IntPtr, { IsNativeEnum: true, EnumUnderlyingType: SpecialType.System_UInt64 } => UIntPtr, { IsEnum: true, EnumUnderlyingType: not null } => EnumUnderlyingType.GetKeyword (),
{ IsSmartEnum: true } => NativeHandle,
{ IsNativeEnum: true, EnumUnderlyingType: SpecialType.System_Int64 } => IntPtr,
{ IsNativeEnum: true, EnumUnderlyingType: SpecialType.System_UInt64 } => UIntPtr,
{ IsEnum: true, EnumUnderlyingType: not null } => EnumUnderlyingType.GetKeyword (),

// special type that is a keyword (none would be a ref type)
{ SpecialType: SpecialType.System_Void } => SpecialType.GetKeyword (), { SpecialType: not SpecialType.None } => MetadataName,

{ SpecialType: SpecialType.System_Void } => SpecialType.GetKeyword (),

// This should not happen in bindings because all of the types should either be native objects
// nsobjects, or structs
Expand Down

0 comments on commit 7b433d9

Please sign in to comment.