• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Syntax.DelegateDeclarationSyntax类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Microsoft.CodeAnalysis.CSharp.Syntax.DelegateDeclarationSyntax的典型用法代码示例。如果您正苦于以下问题:C# DelegateDeclarationSyntax类的具体用法?C# DelegateDeclarationSyntax怎么用?C# DelegateDeclarationSyntax使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



DelegateDeclarationSyntax类属于Microsoft.CodeAnalysis.CSharp.Syntax命名空间,在下文中一共展示了DelegateDeclarationSyntax类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: VisitDelegateDeclaration

 public override SyntaxNode VisitDelegateDeclaration(DelegateDeclarationSyntax node)
 {
     if (node == null)
         return null;
     var symbol = _semanticModel.GetDeclaredSymbol(node);
     node = (DelegateDeclarationSyntax)base.VisitDelegateDeclaration(node);
     if (!IsPrivateOrInternal(symbol.DeclaredAccessibility))
         node = (DelegateDeclarationSyntax)ApplyDocComment(node, symbol.GetDocumentationCommentId());
     return node;
 }
开发者ID:dotnet,项目名称:import-comments,代码行数:10,代码来源:MoveCommentsRewriter.cs


示例2: SourceDelegateMethodSymbol

 protected SourceDelegateMethodSymbol(
     SourceMemberContainerTypeSymbol delegateType,
     TypeSymbol returnType,
     DelegateDeclarationSyntax syntax,
     MethodKind methodKind,
     DeclarationModifiers declarationModifiers)
     : base(delegateType, syntax.GetReference(), bodySyntaxReferenceOpt: null, location: syntax.Identifier.GetLocation())
 {
     _returnType = returnType;
     this.MakeFlags(methodKind, declarationModifiers, _returnType.SpecialType == SpecialType.System_Void, isExtensionMethod: false);
 }
开发者ID:GloryChou,项目名称:roslyn,代码行数:11,代码来源:SourceDelegateMethodSymbol.cs


示例3: VisitDelegateDeclaration

 /// <summary>
 /// 
 /// </summary>
 /// <param name="node"></param>
 public override sealed void VisitDelegateDeclaration(DelegateDeclarationSyntax node)
 {
     this.OnNodeVisited(node, this.type.IsInstanceOfType(node));
     base.VisitDelegateDeclaration(node);
 }
开发者ID:andry-tino,项目名称:Rosetta,代码行数:9,代码来源:ASTWalkerNodeTypeOperationExecutor.cs


示例4: IsTaskReturningMethod

 private static bool IsTaskReturningMethod(SemanticModel semanticModel, DelegateDeclarationSyntax delegateDeclarationSyntax, CancellationToken cancellationToken)
 {
     return IsTaskType(semanticModel, delegateDeclarationSyntax.ReturnType, cancellationToken);
 }
开发者ID:JaRau,项目名称:StyleCopAnalyzers,代码行数:4,代码来源:SA1615SA1616CodeFixProvider.cs


示例5: GetDeclaredSymbol

        /// <summary>
        /// Given a delegate declaration, get the corresponding type symbol.
        /// </summary>
        /// <param name="declarationSyntax">The syntax node that declares a delegate.</param>
        /// <param name="cancellationToken">The cancellation token.</param>
        /// <returns>The type symbol that was declared.</returns>
        public override INamedTypeSymbol GetDeclaredSymbol(DelegateDeclarationSyntax declarationSyntax, CancellationToken cancellationToken = default(CancellationToken))
        {
            CheckSyntaxNode(declarationSyntax);

            return GetDeclaredType(declarationSyntax);
        }
开发者ID:nileshjagtap,项目名称:roslyn,代码行数:12,代码来源:SyntaxTreeSemanticModel.cs


示例6: HandleDelegateDeclaration

        private static SyntaxNode HandleDelegateDeclaration(DelegateDeclarationSyntax node)
        {
            SyntaxToken triviaToken = node.DelegateKeyword;
            if (triviaToken.IsMissing)
            {
                return null;
            }

            SyntaxKind defaultVisibility = IsNestedType(node) ? SyntaxKind.PrivateKeyword : SyntaxKind.InternalKeyword;
            SyntaxTokenList modifiers = DeclarationModifiersHelper.AddModifier(node.Modifiers, ref triviaToken, defaultVisibility);
            return node
                .WithDelegateKeyword(triviaToken)
                .WithModifiers(modifiers)
                .WithoutFormatting();
        }
开发者ID:Romanx,项目名称:StyleCopAnalyzers,代码行数:15,代码来源:SA1400CodeFixProvider.cs


示例7: VisitDelegateDeclaration

 public override SyntaxNode VisitDelegateDeclaration(DelegateDeclarationSyntax node)
 {
     //Extend:Maybe add support depend on template, e.g. MS Ajax
     return node;
 }
开发者ID:rexzh,项目名称:SharpJs,代码行数:5,代码来源:Rewriter_BasicStructure.cs


示例8: CheckDelegateVariance

        private static void CheckDelegateVariance(DelegateDeclarationSyntax declaration, SyntaxNodeAnalysisContext context)
        {
            var declaredSymbol = context.SemanticModel.GetDeclaredSymbol(declaration);
            if (declaredSymbol == null)
            {
                return;
            }

            var returnType = context.SemanticModel.GetTypeInfo(declaration.ReturnType).Type;
            if (returnType == null)
            {
                return;
            }

            var parameterSymbols = declaration.ParameterList == null
                ? ImmutableArray<IParameterSymbol>.Empty
                : declaration.ParameterList.Parameters
                    .Select(p => context.SemanticModel.GetDeclaredSymbol(p))
                    .ToImmutableArray();
            if (parameterSymbols.Any(parameter => parameter == null))
            {
                return;
            }

            foreach (var typeParameter in declaredSymbol.TypeParameters
                .Where(typeParameter => typeParameter.Variance == VarianceKind.None))
            {
                var canBeIn = CheckTypeParameter(typeParameter, VarianceKind.In, declaredSymbol, returnType, parameterSymbols);
                var canBeOut = CheckTypeParameter(typeParameter, VarianceKind.Out, declaredSymbol, returnType, parameterSymbols);

                if (canBeIn ^ canBeOut)
                {
                    ReportIssue(typeParameter, canBeIn ? VarianceKind.In : VarianceKind.Out, context);
                }
            }
        }
开发者ID:ozgurkayaist,项目名称:sonarlint-vs,代码行数:36,代码来源:GenericTypeParameterInOut.cs


示例9: IsInDelegateDeclaration

        internal static bool IsInDelegateDeclaration(int position, DelegateDeclarationSyntax delegateDecl)
        {
            Debug.Assert(delegateDecl != null);

            return IsBeforeToken(position, delegateDecl, delegateDecl.SemicolonToken);
        }
开发者ID:riversky,项目名称:roslyn,代码行数:6,代码来源:LookupPosition.cs


示例10: CreateField

		/// <summary>
		///     Creates a field declaration that stores <paramref name="methodDelegate" />.
		/// </summary>
		/// <param name="methodDelegate">The delegate the field should be created for.</param>
		private FieldDeclarationSyntax CreateField(DelegateDeclarationSyntax methodDelegate)
		{
			return SyntaxBuilder.Field(GetFieldName(), methodDelegate.Identifier.ValueText, Visibility.Private,
				_browsableAttribute, _compilerGeneratedAttribute).AsSingleLine();
		}
开发者ID:cubeme,项目名称:safety-sharp,代码行数:9,代码来源:MethodNormalizer.cs


示例11: GetSourceTypeMember

 /// <summary>
 /// Get a source type symbol for the given declaration syntax.
 /// </summary>
 /// <returns>Null if there is no matching declaration.</returns>
 internal SourceNamedTypeSymbol GetSourceTypeMember(DelegateDeclarationSyntax syntax)
 {
     return GetSourceTypeMember(syntax.Identifier.ValueText, syntax.Arity, syntax.Kind(), syntax);
 }
开发者ID:CAPCHIK,项目名称:roslyn,代码行数:8,代码来源:NamespaceOrTypeSymbol.cs


示例12: GetDeclaredSymbol

        /// <summary>
        /// Given a delegate declaration, get the corresponding type symbol.
        /// </summary>
        /// <param name="declarationSyntax">The syntax node that declares a delegate.</param>
        /// <param name="cancellationToken">The cancellation token.</param>
        /// <returns>The type symbol that was declared.</returns>
        public override INamedTypeSymbol GetDeclaredSymbol(DelegateDeclarationSyntax declarationSyntax, CancellationToken cancellationToken = default(CancellationToken))
        {
            using (Logger.LogBlock(FunctionId.CSharp_SemanticModel_GetDeclaredSymbol, message: this.SyntaxTree.FilePath, cancellationToken: cancellationToken))
            {
                CheckSyntaxNode(declarationSyntax);

                return GetDeclaredType(declarationSyntax);
            }
        }
开发者ID:elemk0vv,项目名称:roslyn-1,代码行数:15,代码来源:SyntaxTreeSemanticModel.cs


示例13: VisitDelegateDeclaration

 public override void VisitDelegateDeclaration(DelegateDeclarationSyntax node)
 {
     if (compilation != null)
     {
         var type = compilation.GetSemanticModel(node.SyntaxTree).GetDeclaredSymbol(node);
         types.Add(type);                
     }
     delegateDeclarations.Add(node);
     base.VisitDelegateDeclaration(node);
 }
开发者ID:x335,项目名称:WootzJs,代码行数:10,代码来源:TypeCollector.cs


示例14: VisitDelegateDeclaration

        public override void VisitDelegateDeclaration(DelegateDeclarationSyntax node)
        {
            LS2IL.TypeExtraInfo.ClassMetadataGenerator wasClass = CurrentClass;

            INamedTypeSymbol s = Model.GetDeclaredSymbol(node);
            //System.Console.WriteLine(s.GetFullyQualifiedName());
            TypeExtraInfo tei = Chunk.AddTypeExtraInfo(s, Model, IsLibrary);
            CurrentClass = tei.MetadataGenerator;

            base.VisitDelegateDeclaration(node);
            CurrentClass = wasClass;
        }
开发者ID:LaxLacks,项目名称:ls2csc,代码行数:12,代码来源:DeclarationCollector.cs


示例15: VisitDelegateDeclaration

 public override void VisitDelegateDeclaration(DelegateDeclarationSyntax node)
 {
     CheckXmlDocForErrors(node, semanticModel.GetDeclaredSymbol(node));
 }
开发者ID:alecor191,项目名称:RefactoringEssentials,代码行数:4,代码来源:XmlDocAnalyzer.cs


示例16: GetDelegatePrototype

        private string GetDelegatePrototype(DelegateDeclarationSyntax node, INamedTypeSymbol symbol, PrototypeFlags flags)
        {
            if ((flags & PrototypeFlags.Signature) != 0)
            {
                if (flags != PrototypeFlags.Signature)
                {
                    // vsCMPrototypeUniqueSignature can't be combined with anything else.
                    throw Exceptions.ThrowEInvalidArg();
                }

                // The unique signature is simply the node key.
                return GetNodeKey(node).Name;
            }

            var builder = new StringBuilder();

            AppendDelegatePrototype(builder, symbol, flags, GetName(node));

            return builder.ToString();
        }
开发者ID:Rickinio,项目名称:roslyn,代码行数:20,代码来源:CSharpCodeModelService_Prototype.cs


示例17: VisitDelegateDeclaration

			public override void VisitDelegateDeclaration (DelegateDeclarationSyntax node)
			{
				base.VisitDelegateDeclaration (node);
				Append (node);
			}
开发者ID:powerumc,项目名称:monodevelop_korean,代码行数:5,代码来源:CSharpOutlineTextEditorExtension.cs


示例18: GetStartPoint

            private VirtualTreePoint GetStartPoint(SourceText text, DelegateDeclarationSyntax node, EnvDTE.vsCMPart part)
            {
                int startPosition;

                switch (part)
                {
                    case EnvDTE.vsCMPart.vsCMPartName:
                    case EnvDTE.vsCMPart.vsCMPartAttributes:
                    case EnvDTE.vsCMPart.vsCMPartHeader:
                    case EnvDTE.vsCMPart.vsCMPartWhole:
                    case EnvDTE.vsCMPart.vsCMPartBodyWithDelimiter:
                    case EnvDTE.vsCMPart.vsCMPartHeaderWithAttributes:
                        throw Exceptions.ThrowENotImpl();

                    case EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter:
                        if (node.AttributeLists.Count == 0)
                        {
                            throw Exceptions.ThrowEFail();
                        }

                        goto case EnvDTE.vsCMPart.vsCMPartWholeWithAttributes;

                    case EnvDTE.vsCMPart.vsCMPartWholeWithAttributes:
                        startPosition = node.GetFirstToken().SpanStart;
                        break;

                    case EnvDTE.vsCMPart.vsCMPartNavigate:
                        startPosition = node.Identifier.SpanStart;
                        break;

                    case EnvDTE.vsCMPart.vsCMPartBody:
                        throw Exceptions.ThrowEFail();

                    default:
                        throw Exceptions.ThrowEInvalidArg();
                }

                return new VirtualTreePoint(node.SyntaxTree, text, startPosition);
            }
开发者ID:Rickinio,项目名称:roslyn,代码行数:39,代码来源:CSharpCodeModelService.NodeLocator.cs


示例19: Constructor

 internal Constructor(
     SourceMemberContainerTypeSymbol delegateType,
     TypeSymbol voidType,
     TypeSymbol objectType,
     TypeSymbol intPtrType,
     DelegateDeclarationSyntax syntax)
     : base(delegateType, voidType, syntax, MethodKind.Constructor, DeclarationModifiers.Public)
 {
     InitializeParameters(ImmutableArray.Create<ParameterSymbol>(
         new SynthesizedParameterSymbol(this, objectType, 0, RefKind.None, "object"),
         new SynthesizedParameterSymbol(this, intPtrType, 1, RefKind.None, "method")));
 }
开发者ID:GloryChou,项目名称:roslyn,代码行数:12,代码来源:SourceDelegateMethodSymbol.cs


示例20: GetDeclaredSymbol

 public override INamedTypeSymbol GetDeclaredSymbol(DelegateDeclarationSyntax declarationSyntax, CancellationToken cancellationToken = default(CancellationToken))
 {
     // Can't define type inside a member.
     return null;
 }
开发者ID:orthoxerox,项目名称:roslyn,代码行数:5,代码来源:MemberSemanticModel.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Syntax.EqualsValueClauseSyntax类代码示例发布时间:2022-05-26
下一篇:
C# Syntax.ConstructorDeclarationSyntax类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap