Skip to content

Commit

Permalink
[tools] Minor code clean up in dotnet-linker. (#18730)
Browse files Browse the repository at this point in the history
* Remove unusued code.
* Rename method to make it follow the common TryGet... pattern.
  • Loading branch information
rolfbjarne committed Aug 15, 2023
1 parent 637c6b6 commit 9a4b5db
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions tools/common/StaticRegistrar.cs
Expand Up @@ -3310,12 +3310,7 @@ void Specialize (AutoIndentStringBuilder sb, out string initialization_method)
ErrorHelper.ThrowIfErrors (exceptions);
}

bool HasIntPtrBoolCtor (TypeDefinition type, List<Exception> exceptions)
{
return HasIntPtrBoolCtor (type, exceptions, out var _);
}

bool HasIntPtrBoolCtor (TypeDefinition type, List<Exception> exceptions, [NotNullWhen (true)] out MethodDefinition? ctor)
bool TryGetIntPtrBoolCtor (TypeDefinition type, List<Exception> exceptions, [NotNullWhen (true)] out MethodDefinition? ctor)
{
ctor = null;
if (!type.HasMethods)
Expand Down Expand Up @@ -4555,7 +4550,7 @@ public TypeDefinition GetInstantiableType (TypeDefinition td, List<Exception> 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;
Expand Down

7 comments on commit 9a4b5db

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

Please sign in to comment.