public bool ExplicitTypeInference (ResolveContext ec, TypeInferenceContext type_inference, TypeSpec delegate_type)
{
if (!HasExplicitParameters)
return false;
if (!delegate_type.IsDelegate) {
if (delegate_type.GetDefinition () != TypeManager.expression_type)
return false;
delegate_type = TypeManager.GetTypeArguments (delegate_type) [0];
if (!delegate_type.IsDelegate)
return false;
}
AParametersCollection d_params = Delegate.GetParameters (ec.Compiler, delegate_type);
if (d_params.Count != Parameters.Count)
return false;
for (int i = 0; i < Parameters.Count; ++i) {
TypeSpec itype = d_params.Types [i];
if (!TypeManager.IsGenericParameter (itype)) {
if (!TypeManager.HasElementType (itype))
continue;
if (!TypeManager.IsGenericParameter (TypeManager.GetElementType (itype)))
continue;
}
type_inference.ExactInference (Parameters.Types [i], itype);
}
return true;
}