本文整理汇总了C#中SymbolFilter类的典型用法代码示例。如果您正苦于以下问题:C# SymbolFilter类的具体用法?C# SymbolFilter怎么用?C# SymbolFilter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SymbolFilter类属于命名空间,在下文中一共展示了SymbolFilter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FindAsync
public async Task<IEnumerable<ISymbol>> FindAsync(
SearchQuery query, AsyncLazy<IAssemblySymbol> lazyAssembly, SymbolFilter filter, CancellationToken cancellationToken)
{
return SymbolFinder.FilterByCriteria(
await FindAsyncWorker(query, lazyAssembly, cancellationToken).ConfigureAwait(false),
filter);
}
示例2: FindDeclarationsAsyncImpl
private static async Task<IEnumerable<ISymbol>> FindDeclarationsAsyncImpl(
Project project, string name, bool ignoreCase, SymbolFilter criteria, CancellationToken cancellationToken)
{
var compilation = await project.GetCompilationAsync(cancellationToken).ConfigureAwait(false);
var list = new List<ISymbol>();
// get declarations from the compilation's assembly
await AddDeclarationsAsync(project, name, ignoreCase, criteria, list, cancellationToken).ConfigureAwait(false);
// get declarations from directly referenced projects and metadata
foreach (var assembly in compilation.GetReferencedAssemblySymbols())
{
var assemblyProject = project.Solution.GetProject(assembly, cancellationToken);
if (assemblyProject != null)
{
await AddDeclarationsAsync(assemblyProject, compilation, assembly, name, ignoreCase, criteria, list, cancellationToken).ConfigureAwait(false);
}
else
{
await AddDeclarationsAsync(project.Solution, assembly, GetMetadataReferenceFilePath(compilation.GetMetadataReference(assembly)), name, ignoreCase, criteria, list, cancellationToken).ConfigureAwait(false);
}
}
return TranslateNamespaces(list, compilation);
}
示例3: MatchFilter
public override bool MatchFilter(SymbolFilter filter) {
if ((filter & SymbolFilter.Members) == 0) {
return false;
}
SymbolFilter memberTypeFilter = (filter & SymbolFilter.AnyMember);
if ((memberTypeFilter == SymbolFilter.InstanceMembers) &&
((_visibility & MemberVisibility.Static) != 0)) {
// Filter specifies member should be an instance member;
// Visibility of member indicates it is a static member.
return false;
}
if ((memberTypeFilter == SymbolFilter.StaticMembers) &&
((_visibility & MemberVisibility.Static) == 0)) {
// Filter specifies member should be a static member;
// Visibility of member indicates it is an instance member.
return false;
}
SymbolFilter visibilityFilter = (filter & SymbolFilter.AnyVisibility);
if ((visibilityFilter == SymbolFilter.Public) &&
((_visibility & (MemberVisibility.Public | MemberVisibility.Internal)) == 0)) {
// Filter specifies member should be public;
// Visibility of member indicates it is not public or internal
return false;
}
if ((visibilityFilter == (SymbolFilter.Public | SymbolFilter.Protected)) &&
((_visibility & (MemberVisibility.Public | MemberVisibility.Internal | MemberVisibility.Protected)) == 0)) {
// Filter specifies member should be public or protected;
// Visibility of member indicates it is not public, internal or protected
return false;
}
return true;
}
示例4: MatchFilter
public override bool MatchFilter(SymbolFilter filter)
{
if ((filter & SymbolFilter.Locals) == 0) {
return false;
}
return true;
}
示例5:
Symbol ISymbolTable.FindSymbol(string name, Symbol context, SymbolFilter filter) {
Debug.Assert(String.IsNullOrEmpty(name) == false);
Debug.Assert(context == null);
Debug.Assert(filter == SymbolFilter.Types);
if (_typeMap.ContainsKey(name)) {
return _typeMap[name];
}
return null;
}
示例6: FindDeclarationsAsync
/// <summary>
/// Find the declared symbols from either source, referenced projects or metadata assemblies with the specified name.
/// </summary>
public static Task<IEnumerable<ISymbol>> FindDeclarationsAsync(
Project project, string name, bool ignoreCase, SymbolFilter filter, CancellationToken cancellationToken = default(CancellationToken))
{
if (name == null)
{
throw new ArgumentNullException(nameof(name));
}
if (string.IsNullOrWhiteSpace(name))
{
return SpecializedTasks.EmptyEnumerable<ISymbol>();
}
return FindDeclarationsAsync(project, new SearchQuery(name, ignoreCase), filter, includeDirectReferences: true, cancellationToken: cancellationToken);
}
示例7:
Symbol ISymbolTable.FindSymbol(string name, Symbol context, SymbolFilter filter) {
Symbol symbol = null;
if ((filter & SymbolFilter.Locals) != 0) {
if (_localTable.ContainsKey(name)) {
symbol = _localTable[name];
}
}
if (symbol == null) {
Debug.Assert(_parentSymbolTable != null);
symbol = _parentSymbolTable.FindSymbol(name, context, filter);
}
return symbol;
}
示例8: FindDeclarationsAsync
/// <summary>
/// Find the declared symbols from either source, referenced projects or metadata assemblies with the specified name.
/// </summary>
public static Task<IEnumerable<ISymbol>> FindDeclarationsAsync(Project project, string name, bool ignoreCase, SymbolFilter filter, CancellationToken cancellationToken = default(CancellationToken))
{
if (project == null)
{
throw new ArgumentNullException(nameof(project));
}
if (name == null)
{
throw new ArgumentNullException(nameof(name));
}
if (string.IsNullOrWhiteSpace(name))
{
return SpecializedTasks.EmptyEnumerable<ISymbol>();
}
using (Logger.LogBlock(FunctionId.SymbolFinder_FindDeclarationsAsync, cancellationToken))
{
return FindDeclarationsAsyncImpl(project, name, ignoreCase, filter, cancellationToken);
}
}
示例9: FindSourceDeclarationsAsync
/// <summary>
/// Find the symbols for declarations made in source with a matching name.
/// </summary>
public static async Task<IEnumerable<ISymbol>> FindSourceDeclarationsAsync(Solution solution, Func<string, bool> predicate, SymbolFilter filter, CancellationToken cancellationToken = default(CancellationToken))
{
if (solution == null)
{
throw new ArgumentNullException(nameof(solution));
}
if (predicate == null)
{
throw new ArgumentNullException(nameof(predicate));
}
using (Logger.LogBlock(FunctionId.SymbolFinder_Solution_Predicate_FindSourceDeclarationsAsync, cancellationToken))
{
var result = new List<ISymbol>();
foreach (var projectId in solution.ProjectIds)
{
var project = solution.GetProject(projectId);
var symbols = await FindSourceDeclarationsAsync(project, predicate, filter, cancellationToken).ConfigureAwait(false);
result.AddRange(symbols);
}
return result;
}
}
示例10: GetDocumentsWithNameAsync
internal async Task<IEnumerable<Document>> GetDocumentsWithNameAsync(Func<string, bool> predicate, SymbolFilter filter, CancellationToken cancellationToken)
{
return (await _solution.State.GetDocumentsWithNameAsync(Id, predicate, filter, cancellationToken).ConfigureAwait(false)).Select(s => _solution.GetDocument(s.Id));
}
示例11: GetDocumentsWithNameAsync
public async Task<IEnumerable<DocumentState>> GetDocumentsWithNameAsync(ProjectId id, Func<string, bool> predicate, SymbolFilter filter, CancellationToken cancellationToken)
{
// this will be used to find documents that contain declaration information in IDE cache such as DeclarationSyntaxTreeInfo for "NavigateTo"
var trees = GetCompilationTracker(id).GetSyntaxTreesWithNameFromDeclarationOnlyCompilation(predicate, filter, cancellationToken);
if (trees != null)
{
return ConvertTreesToDocuments(id, trees);
}
// it looks like declaration compilation doesn't exist yet. we have to build full compilation
var compilation = await GetCompilationAsync(id, cancellationToken).ConfigureAwait(false);
if (compilation == null)
{
// some projects don't support compilations (e.g., TypeScript) so there's nothing to check
return SpecializedCollections.EmptyEnumerable<DocumentState>();
}
return ConvertTreesToDocuments(
id, compilation.GetSymbolsWithName(predicate, filter, cancellationToken).SelectMany(s => s.DeclaringSyntaxReferences.Select(r => r.SyntaxTree)));
}
示例12: FindAsync
public async Task<IEnumerable<ISymbol>> FindAsync(
SearchQuery query, AsyncLazy<IAssemblySymbol> lazyAssembly, SymbolFilter filter, CancellationToken cancellationToken)
{
// All entrypoints to this function are Find functions that are only searching
// for specific strings (i.e. they never do a custom search).
Debug.Assert(query.Kind != SearchKind.Custom);
return SymbolFinder.FilterByCriteria(
await FindAsyncWorker(query, lazyAssembly, cancellationToken).ConfigureAwait(false),
filter);
}
示例13: Expression
protected Expression(ExpressionType type, TypeSymbol evaluatedType, SymbolFilter memberMask) {
_type = type;
_evaluatedType = evaluatedType;
_memberMask = memberMask | SymbolFilter.Members;
}
示例14: MeetCriteria
private static bool MeetCriteria(ISymbol symbol, SymbolFilter filter)
{
if (IsOn(filter, SymbolFilter.Namespace) && symbol.Kind == SymbolKind.Namespace)
{
return true;
}
if (IsOn(filter, SymbolFilter.Type) && symbol is ITypeSymbol)
{
return true;
}
if (IsOn(filter, SymbolFilter.Member) && IsNonTypeMember(symbol))
{
return true;
}
return false;
}
示例15: LocalExpression
public LocalExpression(LocalSymbol symbol, SymbolFilter memberMask)
: base(ExpressionType.Local, symbol.ValueType, memberMask)
{
_symbol = symbol;
}