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


C# Syntax.DelegateDeclarationSyntax类代码示例

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


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


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