private static TypeSymbol DelegateReturnType(NamedTypeSymbol delegateType, out RefKind refKind) { NamedTypeSymbol d = delegateType.GetDelegateType(); if ((object)d == null || (object)d.DelegateInvokeMethod == null) { refKind = Microsoft.CodeAnalysis.RefKind.None; return(null); } refKind = d.DelegateInvokeMethod.RefKind; return(d.DelegateInvokeMethod.ReturnType); }
private bool DelegateNeedsReturn(NamedTypeSymbol delegateType) { NamedTypeSymbol d = delegateType.GetDelegateType(); if ((object)d == null || (object)d.DelegateInvokeMethod == null || d.DelegateInvokeMethod.ReturnsVoid) { return(false); } if (IsAsync && this.binder.Compilation.GetWellKnownType(WellKnownType.System_Threading_Tasks_Task) == d.DelegateInvokeMethod.ReturnType) { return(false); } return(true); }
private static MethodSymbol GetCacheKey(NamedTypeSymbol delegateType) { delegateType = delegateType.GetDelegateType(); if (delegateType != null) { var invoke = delegateType.DelegateInvokeMethod; if (invoke != null) { return(invoke); } } // delegateType or DelegateInvokeMethod can be null in cases of malformed delegates // in such case we would want something trivial with no parameters, like a fake static ctor return(new SynthesizedStaticConstructor(delegateType)); }
private static TypeSymbol DelegateReturnType(NamedTypeSymbol delegateType) { NamedTypeSymbol d = delegateType.GetDelegateType(); return(((object)d == null || (object)d.DelegateInvokeMethod == null) ? null : d.DelegateInvokeMethod.ReturnType); }
private static ImmutableArray <ParameterSymbol> DelegateParameters(NamedTypeSymbol delegateType) { NamedTypeSymbol d = delegateType.GetDelegateType(); return(((object)d == null || (object)d.DelegateInvokeMethod == null) ? ImmutableArray <ParameterSymbol> .Empty : d.DelegateInvokeMethod.Parameters); }
private static MethodSymbol DelegateInvokeMethod(NamedTypeSymbol delegateType) { return(delegateType.GetDelegateType()?.DelegateInvokeMethod); }