Skip to content

Commit

Permalink
Exclude non-proxyable interface methods
Browse files Browse the repository at this point in the history
Two changes need to be made to `InterfaceMembersCollector`:

 1. `AcceptMethod` needs to be called with `onlyVirtuals: true`, so that
    it will filter out non-overridable methods during pre-screening.

 2. For such filtered-out methods, it needs to return `null` in order to
    avoid `MinimalisticMethodGenerator` (which would mark the method it
    creates as an override).

These changes have been copied from `ClassMembersCollector`. Note that
the two classes are now almost identical.
  • Loading branch information
stakx committed Jul 22, 2022
1 parent b90c168 commit 95819d5
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,13 @@ protected override MetaMethod GetMethodToGenerate(MethodInfo method, IProxyGener
return null;
}

var proxyable = AcceptMethod(method, false, hook);
var proxyable = AcceptMethod(method, true, hook);
if (!proxyable && !method.IsAbstract)
{
// we don't need to do anything
return null;
}

return new MetaMethod(method, method, isStandalone, proxyable, false);
}
}
Expand Down

0 comments on commit 95819d5

Please sign in to comment.