//////////////////////////////////////////////////////////////////////////////// // // Output types // private bool DoesOutputTypeContain(EXPR pSource, CType pDest, TypeParameterType pParam) { // SPEC: If E is a method group or an anonymous function and T is a delegate // SPEC: CType or expression tree CType then the return CType of T is an output CType // SPEC: of E with CType T. pDest = pDest.GetDelegateTypeOfPossibleExpression(); if (!pDest.isDelegateType()) { return false; } if (!pSource.isUNBOUNDLAMBDA() && !pSource.isMEMGRP()) { return false; } CType pDelegateReturn = pDest.AsAggregateType().GetDelegateReturnType(GetSymbolLoader()); if (pDelegateReturn == null) { return false; } return TypeManager.TypeContainsType(pDelegateReturn, pParam); }
//////////////////////////////////////////////////////////////////////////////// // // Input types // private bool DoesInputTypeContain(EXPR pSource, CType pDest, TypeParameterType pParam) { // SPEC: If E is a method group or an anonymous function and T is a delegate // SPEC: CType or expression tree CType then all the parameter types of T are // SPEC: input types of E with CType T. pDest = pDest.GetDelegateTypeOfPossibleExpression(); if (!pDest.isDelegateType()) { return false; // No input types. } if (!pSource.isUNBOUNDLAMBDA() && !pSource.isMEMGRP()) { return false; // No input types. } TypeArray pDelegateParameters = pDest.AsAggregateType().GetDelegateParameters(GetSymbolLoader()); if (pDelegateParameters == null) { return false; } return TypeManager.ParametersContainTyVar(pDelegateParameters, pParam); }