當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。