本文整理汇总了C#中Microsoft.CodeAnalysis.CSharp.Binder.BindCref方法的典型用法代码示例。如果您正苦于以下问题:C# Binder.BindCref方法的具体用法?C# Binder.BindCref怎么用?C# Binder.BindCref使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.CodeAnalysis.CSharp.Binder
的用法示例。
在下文中一共展示了Binder.BindCref方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BindCref
internal static ImmutableArray<Symbol> BindCref(CrefSyntax crefSyntax, Binder binder)
{
var unusedDiagnostics = DiagnosticBag.GetInstance();
Symbol unusedAmbiguityWinner;
var symbols = binder.BindCref(crefSyntax, out unusedAmbiguityWinner, unusedDiagnostics);
unusedDiagnostics.Free();
return symbols;
}
示例2: GetDocumentationCommentId
/// <summary>
/// Bind a CrefSyntax and unwrap the result if it's an alias.
/// </summary>
/// <remarks>
/// Does not respect DocumentationMode, so use a temporary bag if diagnostics are not desired.
/// </remarks>
private static string GetDocumentationCommentId(CrefSyntax crefSyntax, Binder binder, DiagnosticBag diagnostics)
{
if (crefSyntax.ContainsDiagnostics)
{
return ToBadCrefString(crefSyntax);
}
Symbol ambiguityWinner;
ImmutableArray<Symbol> symbols = binder.BindCref(crefSyntax, out ambiguityWinner, diagnostics);
Symbol symbol;
switch (symbols.Length)
{
case 0:
return ToBadCrefString(crefSyntax);
case 1:
symbol = symbols[0];
break;
default:
symbol = ambiguityWinner;
Debug.Assert((object)symbol != null);
break;
}
if (symbol.Kind == SymbolKind.Alias)
{
symbol = ((AliasSymbol)symbol).GetAliasTarget(basesBeingResolved: null);
}
return symbol.OriginalDefinition.GetDocumentationCommentId();
}