本文整理汇总了C#中Microsoft.CodeAnalysis.CSharp.Symbols.SourceMemberContainerTypeSymbol.IsCompilationOutputWinMdObj方法的典型用法代码示例。如果您正苦于以下问题:C# SourceMemberContainerTypeSymbol.IsCompilationOutputWinMdObj方法的具体用法?C# SourceMemberContainerTypeSymbol.IsCompilationOutputWinMdObj怎么用?C# SourceMemberContainerTypeSymbol.IsCompilationOutputWinMdObj使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.CodeAnalysis.CSharp.Symbols.SourceMemberContainerTypeSymbol
的用法示例。
在下文中一共展示了SourceMemberContainerTypeSymbol.IsCompilationOutputWinMdObj方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddDelegateMembers
internal static void AddDelegateMembers(
SourceMemberContainerTypeSymbol delegateType,
ArrayBuilder<Symbol> symbols,
DelegateDeclarationSyntax syntax,
DiagnosticBag diagnostics)
{
Binder binder = delegateType.GetBinder(syntax.ParameterList);
TypeSymbol returnType = binder.BindType(syntax.ReturnType, diagnostics);
// reuse types to avoid reporting duplicate errors if missing:
var voidType = binder.GetSpecialType(SpecialType.System_Void, diagnostics, syntax);
var objectType = binder.GetSpecialType(SpecialType.System_Object, diagnostics, syntax);
var intPtrType = binder.GetSpecialType(SpecialType.System_IntPtr, diagnostics, syntax);
if (returnType.IsRestrictedType())
{
// Method or delegate cannot return type '{0}'
diagnostics.Add(ErrorCode.ERR_MethodReturnCantBeRefAny, syntax.ReturnType.Location, returnType);
}
// A delegate has the following members: (see CLI spec 13.6)
// (1) a method named Invoke with the specified signature
var invoke = new InvokeMethod(delegateType, returnType, syntax, binder, diagnostics);
invoke.CheckDelegateVarianceSafety(diagnostics);
symbols.Add(invoke);
// (2) a constructor with argument types (object, System.IntPtr)
symbols.Add(new Constructor(delegateType, voidType, objectType, intPtrType, syntax));
if (binder.Compilation.GetSpecialType(SpecialType.System_IAsyncResult).TypeKind != TypeKind.Error &&
binder.Compilation.GetSpecialType(SpecialType.System_AsyncCallback).TypeKind != TypeKind.Error &&
// WinRT delegates don't have Begin/EndInvoke methods
!delegateType.IsCompilationOutputWinMdObj())
{
var iAsyncResultType = binder.GetSpecialType(SpecialType.System_IAsyncResult, diagnostics, syntax);
var asyncCallbackType = binder.GetSpecialType(SpecialType.System_AsyncCallback, diagnostics, syntax);
// (3) BeginInvoke
symbols.Add(new BeginInvokeMethod(invoke, iAsyncResultType, objectType, asyncCallbackType, syntax));
// and (4) EndInvoke methods
symbols.Add(new EndInvokeMethod(invoke, iAsyncResultType, syntax));
}
if (delegateType.DeclaredAccessibility <= Accessibility.Private)
{
return;
}
HashSet<DiagnosticInfo> useSiteDiagnostics = null;
if (!delegateType.IsNoMoreVisibleThan(invoke.ReturnType, ref useSiteDiagnostics))
{
// Inconsistent accessibility: return type '{1}' is less accessible than delegate '{0}'
diagnostics.Add(ErrorCode.ERR_BadVisDelegateReturn, delegateType.Locations[0], delegateType, invoke.ReturnType);
}
foreach (var parameter in invoke.Parameters)
{
if (!parameter.Type.IsAtLeastAsVisibleAs(delegateType, ref useSiteDiagnostics))
{
// Inconsistent accessibility: parameter type '{1}' is less accessible than delegate '{0}'
diagnostics.Add(ErrorCode.ERR_BadVisDelegateParam, delegateType.Locations[0], delegateType, parameter.Type);
}
}
diagnostics.Add(delegateType.Locations[0], useSiteDiagnostics);
}