Skip to content

Commit

Permalink
[bgen] Remove useless catch/(re)throw. (#18467)
Browse files Browse the repository at this point in the history
There's no purpose to catching an exception just to throw it, so remove
the entire try/catch handler.

Fixes this compiler warning:

    src/bgen/Generator.cs(1284,4): warning CA2200: Re-throwing caught exception changes stack information
  • Loading branch information
rolfbjarne committed Jun 20, 2023
1 parent 7cea2a8 commit a66950d
Showing 1 changed file with 9 additions and 13 deletions.
22 changes: 9 additions & 13 deletions src/bgen/Generator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1269,22 +1269,18 @@ void DeclareInvoker (MethodInfo mi)
if (AttributeManager.HasAttribute<WrapAttribute> (mi))
return;

try {
// arm64 never requires stret, so we'll always need the non-stret variants
RegisterMethod (false, mi, MakeSig (mi, false), false);
RegisterMethod (false, mi, MakeSuperSig (mi, false), false);
// arm64 never requires stret, so we'll always need the non-stret variants
RegisterMethod (false, mi, MakeSig (mi, false), false);
RegisterMethod (false, mi, MakeSuperSig (mi, false), false);

if (CheckNeedStret (mi)) {
RegisterMethod (true, mi, MakeSig (mi, true), false);
RegisterMethod (true, mi, MakeSuperSig (mi, true), false);
if (CheckNeedStret (mi)) {
RegisterMethod (true, mi, MakeSig (mi, true), false);
RegisterMethod (true, mi, MakeSuperSig (mi, true), false);

if (AttributeManager.HasAttribute<AlignAttribute> (mi)) {
RegisterMethod (true, mi, MakeSig (mi, true, true), true);
RegisterMethod (true, mi, MakeSuperSig (mi, true, true), true);
}
if (AttributeManager.HasAttribute<AlignAttribute> (mi)) {
RegisterMethod (true, mi, MakeSig (mi, true, true), true);
RegisterMethod (true, mi, MakeSuperSig (mi, true, true), true);
}
} catch (BindingException ex) {
throw ex;
}
}
static char [] invalid_selector_chars = new char [] { '*', '^', '(', ')' };
Expand Down

5 comments on commit a66950d

@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.