[mono-vb] Help required

B Anirban banirban@novell.com
Fri, 11 Jun 2004 10:31:22 -0600

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.

As per vb the following program should work.

Imports System
Module M
	Delegate Sub SD()

	sub f()
	End sub

	sub SetDelegate(del as SD)	
	end sub

	Sub Main()
		SetDelegate(AddressOf f)
	End Sub
End Module

Here "AddressOf f" statement in "SetDelegate" method should construct a
new Delegate and set it to the method.

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.

So, looks like I am in kind of a deadlock. 

Any suggestion or pointer or fresh air of thought would really help.


ps : Normal way of creating a delegate is like this 

Delegate Sub SD()
dim d as SD
d = new SD (AddressOf f)