当前位置: 首页>>代码示例>>C#>>正文


C# SymbolFilter类代码示例

本文整理汇总了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);
 }
开发者ID:Rickinio,项目名称:roslyn,代码行数:7,代码来源:SymbolTreeInfo.cs

示例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);
        }
开发者ID:reudismam,项目名称:roslyn,代码行数:26,代码来源:SymbolFinder_Declarations.cs

示例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;
        }
开发者ID:fugaku,项目名称:scriptsharp,代码行数:34,代码来源:MemberSymbol.cs

示例4: MatchFilter

 public override bool MatchFilter(SymbolFilter filter)
 {
     if ((filter & SymbolFilter.Locals) == 0) {
         return false;
     }
     return true;
 }
开发者ID:mobilligy,项目名称:scriptsharp,代码行数:7,代码来源:LocalSymbol.cs

示例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;
        }
开发者ID:fugaku,项目名称:scriptsharp,代码行数:11,代码来源:NamespaceSymbol.cs

示例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);
        }
开发者ID:VPashkov,项目名称:roslyn,代码行数:18,代码来源:SymbolFinder_Declarations.cs

示例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;
        }
开发者ID:fugaku,项目名称:scriptsharp,代码行数:16,代码来源:SymbolScope.cs

示例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);
            }
        }
开发者ID:reudismam,项目名称:roslyn,代码行数:25,代码来源:SymbolFinder_Declarations.cs

示例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;
            }
        }
开发者ID:reudismam,项目名称:roslyn,代码行数:28,代码来源:SymbolFinder_Declarations.cs

示例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));
 }
开发者ID:tvsonar,项目名称:roslyn,代码行数:4,代码来源:Project.cs

示例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)));
        }
开发者ID:tvsonar,项目名称:roslyn,代码行数:20,代码来源:SolutionState.cs

示例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);
        }
开发者ID:natidea,项目名称:roslyn,代码行数:11,代码来源:SymbolTreeInfo.cs

示例13: Expression

 protected Expression(ExpressionType type, TypeSymbol evaluatedType, SymbolFilter memberMask) {
     _type = type;
     _evaluatedType = evaluatedType;
     _memberMask = memberMask | SymbolFilter.Members;
 }
开发者ID:fugaku,项目名称:scriptsharp,代码行数:5,代码来源:Expression.cs

示例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;
        }
开发者ID:reudismam,项目名称:roslyn,代码行数:19,代码来源:SymbolFinder_Declarations.cs

示例15: LocalExpression

 public LocalExpression(LocalSymbol symbol, SymbolFilter memberMask)
     : base(ExpressionType.Local, symbol.ValueType, memberMask)
 {
     _symbol = symbol;
 }
开发者ID:mobilligy,项目名称:scriptsharp,代码行数:5,代码来源:LocalExpression.cs


注:本文中的SymbolFilter类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。