From 9a4b5db22eb54e4d51e96c31f5f460110018ba3c Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Tue, 15 Aug 2023 18:03:26 +0200 Subject: [PATCH] [tools] Minor code clean up in dotnet-linker. (#18730) * Remove unusued code. * Rename method to make it follow the common TryGet... pattern. --- tools/common/StaticRegistrar.cs | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/tools/common/StaticRegistrar.cs b/tools/common/StaticRegistrar.cs index 450efc50e38..1977fec031b 100644 --- a/tools/common/StaticRegistrar.cs +++ b/tools/common/StaticRegistrar.cs @@ -3310,12 +3310,7 @@ void Specialize (AutoIndentStringBuilder sb, out string initialization_method) ErrorHelper.ThrowIfErrors (exceptions); } - bool HasIntPtrBoolCtor (TypeDefinition type, List exceptions) - { - return HasIntPtrBoolCtor (type, exceptions, out var _); - } - - bool HasIntPtrBoolCtor (TypeDefinition type, List exceptions, [NotNullWhen (true)] out MethodDefinition? ctor) + bool TryGetIntPtrBoolCtor (TypeDefinition type, List exceptions, [NotNullWhen (true)] out MethodDefinition? ctor) { ctor = null; if (!type.HasMethods) @@ -4555,7 +4550,7 @@ public TypeDefinition GetInstantiableType (TypeDefinition td, List ex } // verify that the type has a ctor with two parameters - if (!HasIntPtrBoolCtor (nativeObjType, exceptions, out ctor)) + if (!TryGetIntPtrBoolCtor (nativeObjType, exceptions, out ctor)) throw ErrorHelper.CreateError (4103, Errors.MT4103, nativeObjType.FullName, descriptiveMethodName); return nativeObjType;