Open iskiselev opened 9 years ago
I mostly implemented it, but I have not solved one part yet. @kg, do you know what is the simplest way to resolve MethodInfo from class that implements some interface by MethodInfo from that interface?
Hm, I'm not sure. You probably want to repurpose the interface resolution machinery somehow. Maybe we can pull that stuff out such that you can use it to resolve a single method.
Alternately, we could have the interface resolution logic build a vtable of sorts that contains all that info so that you can pull it out of the vtable. There might be other uses for that, anyway. The current setup is kind of like that, just less formally laid out.
On Wed, Oct 8, 2014 at 2:17 AM, Igor Kiselev notifications@github.com wrote:
I mostly implemented it, but I have not solved one part yet. @kg https://github.com/kg, do you know what is the simplest way to resolve MethodInfo from class that implements some interface by MethodInfo from that interface?
— Reply to this email directly or view it on GitHub https://github.com/sq/JSIL/issues/604#issuecomment-58330855.
Actually, how does this even work? A single method can implement multiple interfaces in .NET. Do the MethodInfos get cloned?
On Wed, Oct 8, 2014 at 3:46 AM, Katelyn Gadd kg@luminance.org wrote:
Hm, I'm not sure. You probably want to repurpose the interface resolution machinery somehow. Maybe we can pull that stuff out such that you can use it to resolve a single method.
Alternately, we could have the interface resolution logic build a vtable of sorts that contains all that info so that you can pull it out of the vtable. There might be other uses for that, anyway. The current setup is kind of like that, just less formally laid out.
On Wed, Oct 8, 2014 at 2:17 AM, Igor Kiselev notifications@github.com wrote:
I mostly implemented it, but I have not solved one part yet. @kg https://github.com/kg, do you know what is the simplest way to resolve MethodInfo from class that implements some interface by MethodInfo from that interface?
— Reply to this email directly or view it on GitHub https://github.com/sq/JSIL/issues/604#issuecomment-58330855.
@kg, sorry, but don't fully understand your question. In .Net Framework you can create delegate using object instance and MethodInfo from interface that is implemented by that object instance. After it, when you'll check Method property of newly created delegate, it will give you MethodInfo of method in object instance that implement original interface method. It is one case, where we need resolve Method info in type by MethodInfo in interface. There will be only one such MethodInfo. If I don't answer your question, please clarify it.
In .Net Framework, Delegate types has
Method
property, that return MethodInfo of target method, or MethodInfo for last delegate for combined Delegate. Test case: