private ICallSite ResolveCallSite(IMethodSignature methodSig, IModule context, ICodeNode genericContext)
        {
            var returnType = ResolveType(methodSig.ReturnType, context, null);

            if (returnType == null)
            {
                return(null);
            }

            var arguments = new IType[methodSig.GetArgumentCountNoVarArgs()];

            for (int i = 0; i < arguments.Length; i++)
            {
                var argumentType = ResolveType(methodSig.Arguments[i], context, null);
                if (argumentType == null)
                {
                    return(null);
                }

                arguments[i] = argumentType;
            }

            return(MakeCallSite(
                       methodSig.HasThis,
                       methodSig.ExplicitThis,
                       methodSig.VarArgIndex,
                       methodSig.CallConv,
                       returnType,
                       ReadOnlyList <IType> .Create(arguments)));
        }
        internal bool Equals(IMethodSignature x, IMethodSignature y, ICodeNode xGenericContext = null)
        {
            if (x.Name != y.Name)
            {
                return(false);
            }

            if (x.HasThis != y.HasThis)
            {
                return(false);
            }

            if (x.CallConv != y.CallConv)
            {
                return(false);
            }

            if (x.GenericParameterCount != y.GenericParameterCount)
            {
                return(false);
            }

            int xArgumentCount = x.GetArgumentCountNoVarArgs();
            int yArgumentCount = y.GetArgumentCountNoVarArgs();

            if (xArgumentCount != yArgumentCount)
            {
                return(false);
            }

            if (!EqualsTypes(x.Arguments, y.Arguments, xArgumentCount, xGenericContext))
            {
                return(false);
            }

            if (!EqualsType(x.ReturnType, y.ReturnType, xGenericContext))
            {
                return(false);
            }

            return(true);
        }