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


C# ISyntaxFactsService.GetNameAndArityOfSimpleName方法代码示例

本文整理汇总了C#中ISyntaxFactsService.GetNameAndArityOfSimpleName方法的典型用法代码示例。如果您正苦于以下问题:C# ISyntaxFactsService.GetNameAndArityOfSimpleName方法的具体用法?C# ISyntaxFactsService.GetNameAndArityOfSimpleName怎么用?C# ISyntaxFactsService.GetNameAndArityOfSimpleName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ISyntaxFactsService的用法示例。


在下文中一共展示了ISyntaxFactsService.GetNameAndArityOfSimpleName方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CalculateContext

        private static void CalculateContext(SyntaxNode node, ISyntaxFactsService syntaxFacts, out string name, out int arity, out bool inAttributeContext, out bool hasIncompleteParentMember)
        {
            // Has to be a simple identifier or generic name.
            syntaxFacts.GetNameAndArityOfSimpleName(node, out name, out arity);

            inAttributeContext = syntaxFacts.IsAttributeName(node);
            hasIncompleteParentMember = syntaxFacts.HasIncompleteParentMember(node);
        }
开发者ID:GloryChou,项目名称:roslyn,代码行数:8,代码来源:AbstractAddImportCodeFixProvider.cs

示例2: GetSymbolsAsync

        private Task<IEnumerable<ISymbol>> GetSymbolsAsync(
            Project project,
            SyntaxNode node,
            SemanticModel semanticModel,
            ISyntaxFactsService syntaxFacts,
            CancellationToken cancellationToken)
        {
            cancellationToken.ThrowIfCancellationRequested();

            // See if the name binds.  If it does, there's nothing further we need to do.
            if (ExpressionBinds(node, semanticModel, cancellationToken, checkForExtensionMethods: true))
            {
                return SpecializedTasks.EmptyEnumerable<ISymbol>();
            }

            string name;
            int arity;
            syntaxFacts.GetNameAndArityOfSimpleName(node, out name, out arity);
            if (name == null)
            {
                return SpecializedTasks.EmptyEnumerable<ISymbol>();
            }

            return SymbolFinder.FindDeclarationsAsync(project, name, this.IgnoreCase, SymbolFilter.Member, cancellationToken);
        }
开发者ID:GloryChou,项目名称:roslyn,代码行数:25,代码来源:AbstractAddImportCodeFixProvider.cs

示例3: GetAddMethodsAsync

        private async Task<IEnumerable<IMethodSymbol>> GetAddMethodsAsync(
            Project project,
            Diagnostic diagnostic,
            SyntaxNode node,
            SemanticModel semanticModel,
            ISet<INamespaceSymbol> namespacesInScope,
            ISyntaxFactsService syntaxFacts,
            SyntaxNode expression,
            CancellationToken cancellationToken)
        {
            string name;
            int arity;
            syntaxFacts.GetNameAndArityOfSimpleName(node, out name, out arity);
            if (name != null)
            {
                return SpecializedCollections.EmptyEnumerable<IMethodSymbol>();
            }

            if (IsAddMethodContext(node, semanticModel))
            {
                var symbols = await SymbolFinder.FindDeclarationsAsync(project, "Add", this.IgnoreCase, SymbolFilter.Member, cancellationToken).ConfigureAwait(false);
                return symbols
                    .OfType<IMethodSymbol>()
                    .Where(method => method.IsExtensionMethod &&
                                     method.ContainingType?.IsAccessibleWithin(semanticModel.Compilation.Assembly) == true &&
                                     IsViableExtensionMethod(method, expression, semanticModel, syntaxFacts, cancellationToken));
            }

            return SpecializedCollections.EmptyEnumerable<IMethodSymbol>();
        }
开发者ID:GloryChou,项目名称:roslyn,代码行数:30,代码来源:AbstractAddImportCodeFixProvider.cs

示例4: GetNamespacesForMatchingNamespacesAsync

        private async Task<IEnumerable<INamespaceSymbol>> GetNamespacesForMatchingNamespacesAsync(
            Project project,
            Diagnostic diagnostic,
            SyntaxNode node,
            SemanticModel semanticModel,
            ISet<INamespaceSymbol> namespacesInScope,
            ISyntaxFactsService syntaxFacts,
            CancellationToken cancellationToken)
        {
            if (!this.CanAddImportForNamespace(diagnostic, ref node))
            {
                return null;
            }

            string name;
            int arity;
            syntaxFacts.GetNameAndArityOfSimpleName(node, out name, out arity);

            if (ExpressionBinds(node, semanticModel, cancellationToken))
            {
                return null;
            }

            var symbols = await SymbolFinder.FindDeclarationsAsync(
                project, name, this.IgnoreCase, SymbolFilter.Namespace, cancellationToken).ConfigureAwait(false);

            return GetProposedNamespaces(
                symbols.OfType<INamespaceSymbol>().Select(n => n.ContainingNamespace),
                semanticModel,
                namespacesInScope);
        }
开发者ID:GloryChou,项目名称:roslyn,代码行数:31,代码来源:AbstractAddImportCodeFixProvider.cs


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