From 40f10cf9acc3ef98c71adf0e365a41cb033ad61b Mon Sep 17 00:00:00 2001 From: Manuel de la Pena Date: Thu, 23 Jan 2025 19:06:39 -0500 Subject: [PATCH] I need to fix that .editorconfig :/ --- .../Extensions/TypeSymbolExtensions.Core.cs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/rgen/Microsoft.Macios.Generator/Extensions/TypeSymbolExtensions.Core.cs b/src/rgen/Microsoft.Macios.Generator/Extensions/TypeSymbolExtensions.Core.cs index 0e049b6e4d7..59d8a127d50 100644 --- a/src/rgen/Microsoft.Macios.Generator/Extensions/TypeSymbolExtensions.Core.cs +++ b/src/rgen/Microsoft.Macios.Generator/Extensions/TypeSymbolExtensions.Core.cs @@ -275,15 +275,25 @@ internal static bool TryGetBuiltInTypeSize (this ITypeSymbol symbol, bool is64bi size = 0; return false; } - + +#pragma warning disable format var symbolInfo = ( ContainingNamespace: symbol.ContainingNamespace.ToDisplayString (), Name: symbol.Name, SpecialType: symbol.SpecialType ); - var (currentSize, result) = symbolInfo switch { { SpecialType: SpecialType.System_Void } => (0, true), { ContainingNamespace: "ObjCRuntime", Name: "NativeHandle" } => (is64bits ? 8 : 4, true), { ContainingNamespace: "System.Runtime.InteropServices", Name: "NFloat" } => (is64bits ? 8 : 4, true), { ContainingNamespace: "System", Name: "Char" or "Boolean" or "SByte" or "Byte" } => (1, true), { ContainingNamespace: "System", Name: "Int16" or "UInt16" } => (2, true), { ContainingNamespace: "System", Name: "Single" or "Int32" or "UInt32" } => (4, true), { ContainingNamespace: "System", Name: "Double" or "Int64" or "UInt64" } => (8, true), { ContainingNamespace: "System", Name: "IntPtr" or "UIntPtr" or "nuint" or "nint" } => (is64bits ? 8 : 4, true), + var (currentSize, result) = symbolInfo switch { + { SpecialType: SpecialType.System_Void } => (0, true), + { ContainingNamespace: "ObjCRuntime", Name: "NativeHandle" } => (is64bits ? 8 : 4, true), + { ContainingNamespace: "System.Runtime.InteropServices", Name: "NFloat" } => (is64bits ? 8 : 4, true), + { ContainingNamespace: "System", Name: "Char" or "Boolean" or "SByte" or "Byte" } => (1, true), + { ContainingNamespace: "System", Name: "Int16" or "UInt16" } => (2, true), + { ContainingNamespace: "System", Name: "Single" or "Int32" or "UInt32" } => (4, true), + { ContainingNamespace: "System", Name: "Double" or "Int64" or "UInt64" } => (8, true), + { ContainingNamespace: "System", Name: "IntPtr" or "UIntPtr" or "nuint" or "nint" } => (is64bits ? 8 : 4, true), _ => (0, false) }; +#pragma warning restore format size = currentSize; return result; }