From 7b433d94923e879d90571a92835c6b783456785c Mon Sep 17 00:00:00 2001 From: Manuel de la Pena Date: Wed, 22 Jan 2025 20:00:57 -0500 Subject: [PATCH] Undo evil formatting. --- .../DataModel/TypeInfo.cs | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/rgen/Microsoft.Macios.Generator/DataModel/TypeInfo.cs b/src/rgen/Microsoft.Macios.Generator/DataModel/TypeInfo.cs index 5717c87b524..49a2f61401c 100644 --- a/src/rgen/Microsoft.Macios.Generator/DataModel/TypeInfo.cs +++ b/src/rgen/Microsoft.Macios.Generator/DataModel/TypeInfo.cs @@ -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