[mono-vb] Help required
Sat, 12 Jun 2004 20:08:17 +0100
Comments are inline.
B Anirban wrote:
> Hey Guys,
> I was looking after the bug # 59555 and trying to complete the
> AddressOf grammar.
> This is probably the Most wired vb statement I am trying implement in
> my last 3 months vb compiler carrier.
<snip VB code and some commentary>
> Now for creating a delegate we need the Delegate type (SD in this case)
> and the function name.
> For getting the Delegate type we need to goto DoResolve of Invocation
> class where the "overloadResolve" function would try to find out the
> method it matches. Since I don't know the type of the delegate I could
> not create a delegate till this point and hence not able to resolve the
> overloaded method. And as long as I don't get the exact method it is not
> possible to get the type of the delegate.
Whenever you encounter something like:
you can use the following overload resolution process:
* work out all the possible types of the expression "AddressOf
SomeOtherProc". To do this, you create a delegate signature for all
overloads of "SomeOtherProc".
* once you have the above list of delegate signatures, you look at all
the overloads of "SomeProc" and see if any has a signature that matches
the types from the list.
Maybe some rough pseudo-code would help:
Work out the potential list of delegate types we can create:
For Each overload Of SomeProc
For Each parameter Of overload
If TypeFor(parameter) Is Delegate Then
Work out the possible types of the expression "AddressOf SomeOtherProc"
For Each overload Of SomeOtherProc
For Each delegate in ListOfDelegates
If delegate's signature = overload's signature Then
Now that you know the possible delegate types for the "AddressOf
SomeOtherProc" expression in PossibleTypesList, you can follow the
overload resolution process as normal.
> So, looks like I am in kind of a deadlock.
> Any suggestion or pointer or fresh air of thought would really help.
Try out the above algorithm, I hope it helps!
> ps : Normal way of creating a delegate is like this
> Delegate Sub SD()
> dim d as SD
> d = new SD (AddressOf f)
> Mono-vb mailing list