TypeContainsType() public static method

public static TypeContainsType ( CType type, CType typeFind ) : bool
type CType
typeFind CType
return bool
コード例 #1
0
        public TypeArray typeVars;          // All the type variables for a generic method, as declarations.

        // If there is a type variable in the method which is used in no parameter,
        // then inference must fail. Since this is expensive to check, we cache
        // the result of the first call.

        public bool InferenceMustFail()
        {
            if (_checkedInfMustFail)
            {
                return(_inferenceMustFail);
            }
            Debug.Assert(!_inferenceMustFail);
            _checkedInfMustFail = true;
            for (int ivar = 0; ivar < typeVars.Count; ivar++)
            {
                TypeParameterType var = (TypeParameterType)typeVars[ivar];
                // See if type var is used in a parameter.
                for (int ipar = 0; ; ipar++)
                {
                    if (ipar >= Params.Count)
                    {
                        // This type variable is not in any parameter.
                        _inferenceMustFail = true;
                        return(true);
                    }
                    if (TypeManager.TypeContainsType(Params[ipar], var))
                    {
                        break;
                    }
                }
            }
            // All type variables are used in a parameter.
            return(false);
        }
コード例 #2
0
        public TypeArray typeVars;          // All the type variables for a generic method, as declarations.

        // If there is a type variable in the method which is used in no parameter,
        // then inference must fail. Since this is expensive to check, we cache
        // the result of the first call.

        public bool InferenceMustFail()
        {
            if (checkedInfMustFail)
            {
                return(inferenceMustFail);
            }
            Debug.Assert(!inferenceMustFail);
            checkedInfMustFail = true;
            for (int ivar = 0; ivar < typeVars.Size; ivar++)
            {
                TypeParameterType var = typeVars.ItemAsTypeParameterType(ivar);
                // See if type var is used in a parameter.
                for (int ipar = 0; ; ipar++)
                {
                    if (ipar >= Params.Size)
                    {
                        // This type variable is not in any parameter.
                        inferenceMustFail = true;
                        return(true);
                    }
                    if (TypeManager.TypeContainsType(Params.Item(ipar), var))
                    {
                        break;
                    }
                }
            }
            // All type variables are used in a parameter.
            return(false);
        }