How to detect implicit overriding

63 views
Skip to first unread message

Hamish Arblaster

unread,
Oct 21, 2020, 12:06:37 PM10/21/20
to mono-cecil
Hello, can someone please explain specifically how implicit overriding works and how I can get a list of direct implicit overrides using Mono.Cecil.
So basically what I know is that IsReuseSlot is relevant to class virtual methods, but is how is it done for interfaces, and is it always an implicit override for IsReuseSlot (except for .ctor seems to have it too), and how would it interact with generics, and do default interface implementations interact in a way that is problematic?

Example of what I'm after
Method a is virtual
Method b implicitly overrides method a
Method c explicitly overrides method a
Method d implicitly overrides method b and is sealed
Method e is in a class that overrides method d and is NewSlot (or new in c#)
Method f implicitly overrides method e

Calling the hypothetical method that returns the direct implicit overrides would return the following:
a -> []
b -> [a]
c -> []
d -> [b]
e -> []
f -> [e]

How would I go about doing this?
Thanks in advance!

Jb Evain

unread,
Oct 21, 2020, 12:54:44 PM10/21/20
to mono-...@googlegroups.com
Hi,

There's no built-in way to achieve this, this is not an easy problem.

The Mono linker creates a map of methods:


By browsing the type hierarchy for implicit overrides and checking the explicit overrides in the metadata.

Jb

--
--
--
mono-cecil
---
You received this message because you are subscribed to the Google Groups "mono-cecil" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mono-cecil+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mono-cecil/ad3bf8ab-7081-4564-a038-63ef0582b58fn%40googlegroups.com.

Hamish Arblaster

unread,
Oct 21, 2020, 4:18:57 PM10/21/20
to mono-cecil
Thanks!
I'll try using that later today.

Reply all
Reply to author
Forward
0 new messages