本文整理汇总了C#中Microsoft.CodeAnalysis.CSharp.Binder.WithAdditionalFlags方法的典型用法代码示例。如果您正苦于以下问题:C# Binder.WithAdditionalFlags方法的具体用法?C# Binder.WithAdditionalFlags怎么用?C# Binder.WithAdditionalFlags使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.CodeAnalysis.CSharp.Binder
的用法示例。
在下文中一共展示了Binder.WithAdditionalFlags方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MemberSemanticModel
protected MemberSemanticModel(CSharpCompilation compilation, CSharpSyntaxNode root, Symbol memberSymbol, Binder rootBinder, SyntaxTreeSemanticModel parentSemanticModelOpt, int speculatedPosition)
{
Debug.Assert(compilation != null);
Debug.Assert(root != null);
Debug.Assert((object)memberSymbol != null);
Debug.Assert(parentSemanticModelOpt == null || !parentSemanticModelOpt.IsSpeculativeSemanticModel, CSharpResources.ChainingSpeculativeModelIsNotSupported);
this.compilation = compilation;
this.root = root;
this.memberSymbol = memberSymbol;
this.RootBinder = rootBinder.WithAdditionalFlags(BinderFlags.SemanticModel);
this.parentSemanticModelOpt = parentSemanticModelOpt;
this.speculatedPosition = speculatedPosition;
}
示例2: GetReducedAndFilteredMethodGroupSymbols
internal static ImmutableArray<MethodSymbol> GetReducedAndFilteredMethodGroupSymbols(Binder binder, BoundMethodGroup node)
{
var methods = ArrayBuilder<MethodSymbol>.GetInstance();
var filteredMethods = ArrayBuilder<MethodSymbol>.GetInstance();
var resultKind = LookupResultKind.Empty;
var typeArguments = node.TypeArgumentsOpt;
// Non-extension methods.
if (node.Methods.Any())
{
// This is the only place we care about overridden/hidden methods. If there aren't methods
// in the method group, there's only one fallback candidate and extension methods never override
// or hide instance methods or other extension methods.
ImmutableArray<MethodSymbol> nonHiddenMethods = FilterOverriddenOrHiddenMethods(node.Methods);
Debug.Assert(nonHiddenMethods.Any()); // Something must be hiding, so can't all be hidden.
foreach (var method in nonHiddenMethods)
{
MergeReducedAndFilteredMethodGroupSymbol(
methods,
filteredMethods,
new SingleLookupResult(node.ResultKind, method, node.LookupError),
typeArguments,
null,
ref resultKind);
}
}
else
{
var otherSymbol = node.LookupSymbolOpt;
if (((object)otherSymbol != null) && (otherSymbol.Kind == SymbolKind.Method))
{
MergeReducedAndFilteredMethodGroupSymbol(
methods,
filteredMethods,
new SingleLookupResult(node.ResultKind, otherSymbol, node.LookupError),
typeArguments,
null,
ref resultKind);
}
}
var receiver = node.ReceiverOpt;
var name = node.Name;
// Extension methods, all scopes.
if (node.SearchExtensionMethods)
{
Debug.Assert(receiver != null);
int arity;
LookupOptions options;
if (typeArguments.IsDefault)
{
arity = 0;
options = LookupOptions.AllMethodsOnArityZero;
}
else
{
arity = typeArguments.Length;
options = LookupOptions.Default;
}
binder = binder.WithAdditionalFlags(BinderFlags.SemanticModel);
foreach (var scope in new ExtensionMethodScopes(binder))
{
var extensionMethods = ArrayBuilder<MethodSymbol>.GetInstance();
var otherBinder = scope.Binder;
otherBinder.GetCandidateExtensionMethods(scope.SearchUsingsNotNamespace,
extensionMethods,
name,
arity,
options,
originalBinder: binder);
foreach (var method in extensionMethods)
{
HashSet<DiagnosticInfo> useSiteDiagnostics = null;
MergeReducedAndFilteredMethodGroupSymbol(
methods,
filteredMethods,
binder.CheckViability(method, arity, options, accessThroughType: null, diagnose: false, useSiteDiagnostics: ref useSiteDiagnostics),
typeArguments,
receiver.Type,
ref resultKind);
}
extensionMethods.Free();
}
}
methods.Free();
return filteredMethods.ToImmutableAndFree();
}