Mono.CSharp.AnonymousMethodExpression.CompatibleChecks C# (CSharp) Method

CompatibleChecks() private method

private CompatibleChecks ( ResolveContext ec, System.TypeSpec delegate_type ) : System.TypeSpec
ec ResolveContext
delegate_type System.TypeSpec
return System.TypeSpec
		TypeSpec CompatibleChecks (ResolveContext ec, TypeSpec delegate_type)
		{
			if (delegate_type.IsDelegate)
				return delegate_type;

			if (delegate_type.IsGeneric && delegate_type.GetDefinition () == TypeManager.expression_type) {
				delegate_type = delegate_type.TypeArguments [0];
				if (delegate_type.IsDelegate)
					return delegate_type;

				ec.Report.Error (835, loc, "Cannot convert `{0}' to an expression tree of non-delegate type `{1}'",
					GetSignatureForError (), TypeManager.CSharpName (delegate_type));
				return null;
			}

			ec.Report.Error (1660, loc, "Cannot convert `{0}' to non-delegate type `{1}'",
				      GetSignatureForError (), TypeManager.CSharpName (delegate_type));
			return null;
		}