void ProcessAddressOfInvocation(MethodInvocationExpression node)
{
if (node.Arguments.Count != 1)
{
Error(node, CompilerErrorFactory.MethodArgumentCount(node.Target, "__addressof__", 1));
}
else
{
Expression arg = node.Arguments[0];
EntityType type = GetEntity(arg).EntityType;
if (EntityType.Method != type)
{
var reference = arg as ReferenceExpression;
if (reference != null && type == EntityType.Ambiguous)
{
Error(node, CompilerErrorFactory.AmbiguousReference(arg, reference.Name, ((Ambiguous)arg.Entity).Entities));
}
else
{
Error(node, CompilerErrorFactory.MethodReferenceExpected(arg));
}
}
else
{
BindExpressionType(node, TypeSystemServices.IntPtrType);
}
}
}