예제 #1
0
        public bool Equals(IAstFunctionTypeReference functionType)
        {
            if (functionType == null)
                return false;

            return Enumerable.SequenceEqual(this.GetParameterTypes(), functionType.GetParameterTypes())
                && Equals(this.ReturnType, functionType.ReturnType);
        }
예제 #2
0
        public bool Equals(IAstFunctionTypeReference functionType)
        {
            if (functionType == null)
            {
                return(false);
            }

            return(Enumerable.SequenceEqual(this.ParameterTypes, functionType.GetParameterTypes()) &&
                   Equals(this.ReturnType, functionType.ReturnType));
        }
        private IAstMethodReference CoerceToType(IAstMethodReference function, IAstFunctionTypeReference functionType)
        {
            var genericParameterTypes      = function.GetGenericParameterTypes().ToArray();
            var genericArgumentTypes       = new IAstTypeReference[genericParameterTypes.Length];
            var functionTypeParameterTypes = functionType.GetParameterTypes().ToArray();
            var functionParameterTypes     = (function.ParameterTypes as IList <IAstTypeReference>) ?? function.ParameterTypes.ToArray();

            for (var i = 0; i < genericArgumentTypes.Length; i++)
            {
                var parameterIndex = functionParameterTypes.IndexOf(genericParameterTypes[i]);
                genericArgumentTypes[i] = functionTypeParameterTypes[parameterIndex];
            }

            return(new AstGenericMethodWithTypeArguments(function, genericArgumentTypes, this.genericHelper));
        }