ConstructorInitializerSyntax

We found 10 examples in language CSharp for this search. You will see 40 fragments of code.

        private void Init(ConstructorInitializerSyntax syntax)
        {
            this.syntax = syntax;
            Kind = GetSyntaxKind();
        }

        ConstructorInitializerSyntax ISyntaxWrapper<ConstructorInitializerSyntax>.GetWrapped(ref bool? changed) =>
            GetWrapped(ref changed);

        private protected override void SetSyntaxImpl(Roslyn::SyntaxNode newSyntax)
        {
            SetList(ref arguments, null);
            Init((ConstructorInitializerSyntax)newSyntax);
        }

        /// <summary>
        /// Get the argument that matches <paramref name="parameter"/>.
        /// </summary>
        /// <param name="initializer">The <see cref="ConstructorInitializerSyntax"/>.</param>
        /// <param name="parameter">The <see cref="IParameterSymbol"/>.</param>
        /// <param name="argument">The <see cref="ArgumentSyntax"/>.</param>
        /// <returns>True if a match was found.</returns>
        public static bool TryFindArgument(this ConstructorInitializerSyntax initializer, IParameterSymbol parameter, [NotNullWhen(true)] out ArgumentSyntax? argument)
        {
            if (initializer is null)
            {
                throw new System.ArgumentNullException(nameof(initializer));
            }

            if (parameter is null)
            {
                throw new System.ArgumentNullException(nameof(parameter));
            }

            argument = null;
            return initializer.ArgumentList is { } argumentList &&
                   argumentList.TryFind(parameter, out argument);
        }

        /// <summary>
        /// Get the argument that matches <paramref name="parameter"/>.
        /// </summary>
        /// <param name="initializer">The <see cref="ConstructorInitializerSyntax"/>.</param>
        /// <param name="parameter">The <see cref="IParameterSymbol"/>.</param>
        /// <param name="arguments">The <see cref="ImmutableArray{ArgumentSyntax}"/>.</param>
        /// <returns>True if one or more were found.</returns>
        public static bool TryFindArgumentParams(this ConstructorInitializerSyntax initializer, IParameterSymbol parameter, out ImmutableArray<ArgumentSyntax> arguments)
        {
            if (initializer is null)
            {
                throw new System.ArgumentNullException(nameof(initializer));
            }

            if (parameter is null)
            {
                throw new System.ArgumentNullException(nameof(parameter));
            }

            arguments = default;
            return initializer.ArgumentList is { } argumentList &&
                   argumentList.TryFindParams(parameter, out arguments);
        }

        /// <summary>
        /// Try getting the declaration of the invoked method.
        /// </summary>
        /// <param name="invocation">The <see cref="ConstructorInitializerSyntax"/>.</param>
        /// <param name="semanticModel">The <see cref="SemanticModel"/>.</param>
        /// <param name="cancellationToken">The <see cref="CancellationToken"/>.</param>
        /// <param name="declaration">The <see cref="ConstructorDeclarationSyntax"/>.</param>
        /// <returns>True if the declaration was found.</returns>
        public static bool TryGetTargetDeclaration(this ConstructorInitializerSyntax invocation, SemanticModel semanticModel, CancellationToken cancellationToken, [NotNullWhen(true)] out ConstructorDeclarationSyntax? declaration)
        {
            if (invocation is null)
            {
                throw new System.ArgumentNullException(nameof(invocation));
            }

            if (semanticModel is null)
            {
                throw new System.ArgumentNullException(nameof(semanticModel));
            }

            declaration = null;
            return semanticModel.TryGetSymbol(invocation, cancellationToken, out var symbol) &&
                   symbol.TrySingleDeclaration(cancellationToken, out declaration);
        }


        public ConstructorSyntaxBuilder WithBaseInitializer(params string[] arguments) => WithBaseInitializer(arguments?.Select(a => ParseExpression(a)));

        public ConstructorSyntaxBuilder WithBaseInitializer(params ExpressionSyntax[] arguments) => WithBaseInitializer(arguments.AsEnumerable());

        public ConstructorSyntaxBuilder WithBaseInitializer(IEnumerable<ExpressionSyntax> arguments) => WithBaseInitializer(arguments?.Select(Argument));

        public ConstructorSyntaxBuilder WithBaseInitializer(params ArgumentSyntax[] arguments) => WithBaseInitializer(arguments.AsEnumerable());

        public ConstructorSyntaxBuilder WithBaseInitializer(IEnumerable<ArgumentSyntax> arguments) => WithInitializer(SyntaxKind.BaseConstructorInitializer, arguments);

        public ConstructorSyntaxBuilder WithInitializer(params string[] arguments) => WithInitializer(arguments?.Select(a => ParseExpression(a)));

		public static async Task<ParameterIndexResult> GetCurrentParameterIndex (Document document, int startOffset, int caretOffset, CancellationToken cancellationToken = default(CancellationToken))
		{
			List<string> usedNamedParameters = null;
			if (startOffset < 0)
				return ParameterIndexResult.Invalid;

			var tree = await document.GetSyntaxTreeAsync (cancellationToken).ConfigureAwait (false);
			var root = await tree.GetRootAsync (cancellationToken).ConfigureAwait (false);
			if (startOffset >= root.FullSpan.Length)
				return ParameterIndexResult.Invalid;
			var token = root.FindToken (startOffset);
			if (token.Parent == null)
				return ParameterIndexResult.Invalid;

			SyntaxNode argList = null;

			var invocation = token.Parent.AncestorsAndSelf ().FirstOrDefault (n =>
				n is InvocationExpressionSyntax ||
			                 n is ObjectCreationExpressionSyntax ||
			                 n is ElementAccessExpressionSyntax ||
			                 n is ConstructorInitializerSyntax ||
			                 n is AttributeSyntax);
			if (invocation is InvocationExpressionSyntax) {
				argList = ((InvocationExpressionSyntax)invocation).ArgumentList;
			} else if (invocation is ObjectCreationExpressionSyntax) {
				argList = ((ObjectCreationExpressionSyntax)invocation).ArgumentList;
			} else if (invocation is ElementAccessExpressionSyntax) {
				argList = ((ElementAccessExpressionSyntax)invocation).ArgumentList;
			} else if (invocation is ConstructorInitializerSyntax) {
				argList = ((ConstructorInitializerSyntax)invocation).ArgumentList;
			} else if (invocation is AttributeSyntax) {
				argList = ((AttributeSyntax)invocation).ArgumentList;
			}
			if (argList == null)
				return ParameterIndexResult.Invalid;
			int i = 0;
			int j = 0;
			if (caretOffset <= argList.SpanStart || caretOffset >= argList.Span.End) {
				return ParameterIndexResult.Invalid;
			}
			
			foreach (var child in argList.ChildNodesAndTokens ()) {
				if (child.Span.End > caretOffset) {
					if (i == 0 && j <= 1)
						return ParameterIndexResult.First;
					return new ParameterIndexResult (usedNamedParameters != null ? usedNamedParameters.ToArray () : null, i + 1);
				}

				if (child.IsToken) {
					if (child.IsKind (Microsoft.CodeAnalysis.CSharp.SyntaxKind.CommaToken))
						i++;
				} else {
					var node = child.AsNode () as ArgumentSyntax;
					if (node != null && node.NameColon != null) {
						if (usedNamedParameters == null)
							usedNamedParameters = new List<string> ();
						usedNamedParameters.Add (node.NameColon.Name.Identifier.Text);
					}
				}
				j++;
			}
			if (j > 0) {
				return new ParameterIndexResult (usedNamedParameters != null ? usedNamedParameters.ToArray () : null, i + 1);
			}
			return ParameterIndexResult.Invalid;
		}


    public override FixAllProvider GetFixAllProvider()
    {
        return WellKnownFixAllProviders.BatchFixer;
    }

    public override async Task RegisterCodeFixesAsync(CodeFixContext context)
    {
        var root = await context.Document.GetSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false);
        // In case the ArrayCreationExpressionSyntax is wrapped in an ArgumentSyntax or some other node with the same span,
        // get the innermost node for ties.
        var nodeToFix = root?.FindNode(context.Span, getInnermostNodeForTie: true);
        if (nodeToFix == null)
            return;

        var title = "Add parameter name";
        var codeAction = CodeAction.Create(
            title,
            ct => AddParameterName(context.Document, nodeToFix, ct),
            equivalenceKey: title);

        context.RegisterCodeFix(codeAction, context.Diagnostics);
    }

    private static async Task<Document> AddParameterName(Document document, SyntaxNode nodeToFix, CancellationToken cancellationToken)
    {
        var editor = await DocumentEditor.CreateAsync(document, cancellationToken).ConfigureAwait(false);
        var semanticModel = editor.SemanticModel;

        var argument = nodeToFix.FirstAncestorOrSelf<ArgumentSyntax>();
        if (argument == null || argument.NameColon != null)
            return document;

        var parameters = FindParameters(semanticModel, argument);
        if (parameters == null)
            return document;

        var index = NamedParameterAnalyzer.ArgumentIndex(argument);
        if (index < 0 || index >= parameters.Count)
            return document;

        var parameter = parameters[index];
        var argumentName = parameter.Name;

        editor.ReplaceNode(argument, argument.WithNameColon(SyntaxFactory.NameColon(argumentName)));
        return editor.GetChangedDocument();
    }

    private static IReadOnlyList<IParameterSymbol>? FindParameters(SemanticModel semanticModel, SyntaxNode? node)
    {
        while (node != null)
        {
            switch (node)
            {
                case InvocationExpressionSyntax invocationExpression:
                    var method = (IMethodSymbol?)semanticModel.GetSymbolInfo(invocationExpression).Symbol;
                    return method?.Parameters;

                case ObjectCreationExpressionSyntax objectCreationExpression:
                    var ctor = (IMethodSymbol?)semanticModel.GetSymbolInfo(objectCreationExpression).Symbol;
                    return ctor?.Parameters;

                case ImplicitObjectCreationExpressionSyntax implicitObjectCreationExpression:
                    var implicitCtor = (IMethodSymbol?)semanticModel.GetSymbolInfo(implicitObjectCreationExpression).Symbol;
                    return implicitCtor?.Parameters;

                case ConstructorInitializerSyntax constructorInitializerSyntax:
                    var ctor2 = (IMethodSymbol?)semanticModel.GetSymbolInfo(constructorInitializerSyntax).Symbol;
                    return ctor2?.Parameters;
            }

            node = node.Parent;
        }

        return null;
    }


        public override void Clear()
        {
            base.Clear();
            _taInitializer = null;
        }

        public new void AddChildren()
        {
            base.AddChildren();
            Kind = Node.Kind();
            _identifier = ((ConstructorDeclarationSyntax) Node).Identifier;
            _identifierIsChanged = false;
            _initializer = ((ConstructorDeclarationSyntax) Node).Initializer;
            _initializerIsChanged = false;
        }

        public override void SetNotChanged()
        {
            base.SetNotChanged();
            IsChanged = false;
        }

        public override SyntaxNode MakeSyntaxNode()
        {
            var res = SyntaxFactory.ConstructorDeclaration(AttributeLists, Modifiers, Identifier, ParameterList,
                Initializer, Body, ExpressionBody, SemicolonToken);
            IsChanged = false;
            return res;
        }

        public override IEnumerable<TameBaseRoslynNode> GetChildren()
        {
            foreach (var item in TaAttributeLists)
                yield return item;
        }

        public override IEnumerable<TameBaseRoslynNode> GetTameFields()
        {
            if (TaInitializer != null) yield return TaInitializer;
            if (TaParameterList != null) yield return TaParameterList;
            if (TaBody != null) yield return TaBody;
            if (TaExpressionBody != null) yield return TaExpressionBody;
        }


        public override void VisitConstructorDeclaration(ConstructorDeclarationSyntax node)
        {
            if (ReferenceEquals(this.context, node.Parent))
            {
                if (!node.Modifiers.Any(SyntaxKind.PrivateKeyword))
                {
                    this.nonPrivateCtors.Add(node);
                }

                if (node.ParameterList?.Parameters.Count == 0)
                {
                    this.Default = node;
                }
            }

            base.VisitConstructorDeclaration(node);
        }

        public override void VisitObjectCreationExpression(ObjectCreationExpressionSyntax node)
        {
            if (node.Type is SimpleNameSyntax typeName &&
                typeName.Identifier.ValueText == this.context.Identifier.ValueText)
            {
                if (this.semanticModel.GetSymbolSafe(node, this.cancellationToken) is IMethodSymbol ctor &&
                    SymbolComparer.Equals(this.Type, ctor.ContainingType))
                {
                    this.objectCreations.Add(node);
                }
            }
            else if (node.Type is QualifiedNameSyntax qualifiedName &&
                     qualifiedName.Right.Identifier.ValueText == this.context.Identifier.ValueText)
            {
                if (this.semanticModel.GetSymbolSafe(node, this.cancellationToken) is IMethodSymbol ctor &&
                    SymbolComparer.Equals(this.Type, ctor.ContainingType))
                {
                    this.objectCreations.Add(node);
                }
            }
            else if (this.semanticModel.GetSymbolSafe(node, this.cancellationToken) is IMethodSymbol ctor &&
                     SymbolComparer.Equals(this.Type, ctor.ContainingType))
            {
                this.objectCreations.Add(node);
            }

            base.VisitObjectCreationExpression(node);
        }

        public override void VisitConstructorInitializer(ConstructorInitializerSyntax node)
        {
            if (node.Parent?.Parent == this.context)
            {
                this.initializers.Add(node);
            }

            base.VisitConstructorInitializer(node);
        }

        internal static ConstructorsWalker Borrow(TypeDeclarationSyntax context, SemanticModel semanticModel, CancellationToken cancellationToken)
        {
            var walker = Borrow(() => new ConstructorsWalker());
            walker.semanticModel = semanticModel;
            walker.cancellationToken = cancellationToken;
            walker.context = context;

            if (context.Modifiers.Any(SyntaxKind.PartialKeyword))
            {
                foreach (var reference in walker.Type.DeclaringSyntaxReferences)
                {
                    walker.Visit(reference.GetSyntax(cancellationToken));
                }
            }
            else
            {
                walker.Visit(context);
                if (context is StructDeclarationSyntax)
                {
                    return walker;
                }

                if (context is ClassDeclarationSyntax classDeclaration &&
                    classDeclaration.BaseList == null)
                {
                    return walker;
                }
            }

            if (walker.nonPrivateCtors.Count == 0 &&
                walker.Default == null)
            {
                if (Constructor.TryGetDefault(walker.Type, out var @default))
                {
                    foreach (var reference in @default.DeclaringSyntaxReferences)
                    {
                        walker.Default = (ConstructorDeclarationSyntax)reference.GetSyntax(cancellationToken);
                        walker.Visit(walker.Default);
                    }
                }
            }

            return walker;
        }

        protected override void Clear()
        {
            this.nonPrivateCtors.Clear();
            this.objectCreations.Clear();
            this.initializers.Clear();
            this.Default = null;
            this.semanticModel = null;
            this.cancellationToken = CancellationToken.None;
            this.type = null;
            this.context = null;
        }


        public override void VisitConstructorDeclaration(ConstructorDeclarationSyntax node)
        {
            if (ReferenceEquals(this.context, node.Parent))
            {
                if (!node.Modifiers.Any(SyntaxKind.PrivateKeyword))
                {
                    this.nonPrivateCtors.Add(node);
                }

                if (node.ParameterList.Parameters.Count == 0)
                {
                    this.Default = node;
                }
            }

            base.VisitConstructorDeclaration(node);
        }

        public override void VisitObjectCreationExpression(ObjectCreationExpressionSyntax node)
        {
            if (node.Type is SimpleNameSyntax typeName &&
                typeName.Identifier.ValueText == this.context.Identifier.ValueText)
            {
                if (this.semanticModel.TryGetSymbol(node, this.cancellationToken, out var ctor) &&
                    TypeSymbolComparer.Equal(this.Type, ctor.ContainingType))
                {
                    this.objectCreations.Add(node);
                }
            }
            else if (node.Type is QualifiedNameSyntax qualifiedName &&
                     qualifiedName.Right.Identifier.ValueText == this.context.Identifier.ValueText)
            {
                if (this.semanticModel.TryGetSymbol(node, this.cancellationToken, out var ctor) &&
                    TypeSymbolComparer.Equal(this.Type, ctor.ContainingType))
                {
                    this.objectCreations.Add(node);
                }
            }
            else if (this.semanticModel.TryGetSymbol(node, this.cancellationToken, out var ctor) &&
                     TypeSymbolComparer.Equal(this.Type, ctor.ContainingType))
            {
                this.objectCreations.Add(node);
            }

            base.VisitObjectCreationExpression(node);
        }

        public override void VisitConstructorInitializer(ConstructorInitializerSyntax node)
        {
            if (node.Parent?.Parent == this.context)
            {
                this.initializers.Add(node);
            }

            base.VisitConstructorInitializer(node);
        }

        internal static ConstructorsWalker Borrow(TypeDeclarationSyntax context, SemanticModel semanticModel, CancellationToken cancellationToken)
        {
            var walker = Borrow(() => new ConstructorsWalker());
            walker.semanticModel = semanticModel;
            walker.cancellationToken = cancellationToken;
            walker.context = context;

            if (context.Modifiers.Any(SyntaxKind.PartialKeyword))
            {
                foreach (var reference in walker.Type.DeclaringSyntaxReferences)
                {
                    walker.Visit(reference.GetSyntax(cancellationToken));
                }
            }
            else
            {
                walker.Visit(context);
                if (context is StructDeclarationSyntax)
                {
                    return walker;
                }

                if (context is ClassDeclarationSyntax { BaseList: null })
                {
                    return walker;
                }
            }

            if (walker.nonPrivateCtors.Count == 0 &&
                walker.Default is null)
            {
                if (Constructor.TryFindDefault(walker.Type, Search.Recursive, out var defaultCtor) &&
                    defaultCtor.TrySingleDeclaration(cancellationToken, out ConstructorDeclarationSyntax? defaultCtorDeclaration))
                {
                    walker.Default = defaultCtorDeclaration;
                    if (!defaultCtorDeclaration.Modifiers.Any(SyntaxKind.PrivateKeyword))
                    {
                        walker.nonPrivateCtors.Add(defaultCtorDeclaration);
                    }

                    walker.Visit(walker.Default);
                }
            }

            return walker;
        }

        protected override void Clear()
        {
            this.nonPrivateCtors.Clear();
            this.objectCreations.Clear();
            this.initializers.Clear();
            this.Default = null!;
            this.semanticModel = null!;
            this.cancellationToken = CancellationToken.None;
            this.type = null!;
            this.context = null!;
        }


		internal override void AnalyzeCompilation(CompilationStartAnalysisContext compilationStartContext, PXContext pxContext)
        {
            compilationStartContext.RegisterSyntaxNodeAction(syntaxContext => AnalyzePXExceptionCtorInvocation(syntaxContext, pxContext), SyntaxKind.ObjectCreationExpression);
            compilationStartContext.RegisterSyntaxNodeAction(syntaxContext => AnalyzePXExceptionCtorInitializer(syntaxContext, pxContext), SyntaxKind.ClassDeclaration);
        }

        private void AnalyzePXExceptionCtorInitializer(SyntaxNodeAnalysisContext syntaxContext, PXContext pxContext)
        {
            syntaxContext.CancellationToken.ThrowIfCancellationRequested();

            if (!(syntaxContext.Node is ClassDeclarationSyntax classDeclaration))
                return;

            INamedTypeSymbol type = syntaxContext.SemanticModel.GetDeclaredSymbol(classDeclaration);
            bool isLocalizableException = type != null && IsLocalizableException(syntaxContext, pxContext, type);

            if (!isLocalizableException)
                return;

            IEnumerable<ConstructorInitializerSyntax> baseCtors = classDeclaration.DescendantNodes()
                                                                  .OfType<ConstructorInitializerSyntax>();
            foreach (ConstructorInitializerSyntax c in baseCtors)
            {
                if (!(syntaxContext.SemanticModel.GetSymbolInfo(c, syntaxContext.CancellationToken).Symbol is IMethodSymbol methodSymbol))
                    continue;

                ImmutableArray<IParameterSymbol> pars = methodSymbol.Parameters;
                ExpressionSyntax messageExpression = GetMessageExpression(syntaxContext, pars, c.ArgumentList);

                if (messageExpression == null)
                    continue;

                LocalizationMessageHelper messageHelper = new LocalizationMessageHelper(syntaxContext, pxContext, messageExpression, false);
                messageHelper.ValidateMessage();
            }
        }

        private ExpressionSyntax GetMessageExpression(SyntaxNodeAnalysisContext syntaxContext, ImmutableArray<IParameterSymbol> pars, ArgumentListSyntax args)
        {
            syntaxContext.CancellationToken.ThrowIfCancellationRequested();

            ArgumentSyntax messageArg = null;

            foreach (ArgumentSyntax a in args.Arguments)
            {
                IParameterSymbol p = a.DetermineParameter(pars, false);

                if (_messageArgNames.Contains(p?.Name, StringComparer.Ordinal))
                {
                    messageArg = a;
                    break;
                }
            }

            if (messageArg == null || messageArg.Expression == null)
                return null;

            return messageArg.Expression;
        }

        private void AnalyzePXExceptionCtorInvocation(SyntaxNodeAnalysisContext syntaxContext, PXContext pxContext)
        {
            syntaxContext.CancellationToken.ThrowIfCancellationRequested();

            if (!(syntaxContext.Node is ObjectCreationExpressionSyntax ctorNode) || ctorNode.ArgumentList == null)
                return;

            ITypeSymbol type = syntaxContext.SemanticModel.GetTypeInfo(ctorNode, syntaxContext.CancellationToken).Type;
            bool isLocalizableException = type != null && IsLocalizableException(syntaxContext, pxContext, type);

            if (!isLocalizableException)
                return;

            if (!(syntaxContext.SemanticModel.GetSymbolInfo(ctorNode, syntaxContext.CancellationToken).Symbol is IMethodSymbol ctorSymbol))
                return;

            ImmutableArray<IParameterSymbol> pars = ctorSymbol.Parameters;
            ExpressionSyntax messageExpression = GetMessageExpression(syntaxContext, pars, ctorNode.ArgumentList);

            if (messageExpression == null)
                return;

            LocalizationMessageHelper messageHelper = new LocalizationMessageHelper(syntaxContext, pxContext, messageExpression, false);
            messageHelper.ValidateMessage();
        }

        private bool IsLocalizableException(SyntaxNodeAnalysisContext syntaxContext, PXContext pxContext, ITypeSymbol type)
        {
            syntaxContext.CancellationToken.ThrowIfCancellationRequested();

            return type.InheritsFromOrEquals(pxContext.Exceptions.PXException) 
                   && !type.InheritsFromOrEquals(pxContext.Exceptions.PXBaseRedirectException);
        }


        public override void Initialize(AnalysisContext context)
        {
            context.RegisterSyntaxNodeAction(AnalyzeSymbol, SyntaxKind.ConstructorDeclaration);
        }

        private void AnalyzeSymbol(SyntaxNodeAnalysisContext context)
        {
            var constructorDeclaration = context.Node as ConstructorDeclarationSyntax;
            if (constructorDeclaration == null)
            {
                return;
            }

            // ctor must be public
            if (!constructorDeclaration.Modifiers.Any(SyntaxKind.PublicKeyword))
            {
                return;
            }

            // ctor must not have parameters
            if (constructorDeclaration.ParameterList.Parameters.Any())
            {
                return;
            }

            // ctor must have no body statements
            if (constructorDeclaration.Body == null || constructorDeclaration.Body.Statements.Any())
            {
                return;
            }

            // ctor must not contain comments
            if (constructorDeclaration.Body.CloseBraceToken.LeadingTrivia.Any(t => t.IsCommentTrivia()))
            {
                return;
            }

            // ctor must not have attributes
            if (constructorDeclaration.AttributeLists.Any())
            {
                return;
            }

            var classSymbol = context.SemanticModel.GetDeclaredSymbol(constructorDeclaration.Parent) as INamedTypeSymbol;
            if (classSymbol != null && classSymbol.Constructors.Count() != 1)
            {
                return;
            }

            if (constructorDeclaration.GetLeadingTrivia().Any(t => t.IsCommentTrivia()))
            {
                return;
            }

            var childNodes = constructorDeclaration.ChildNodes().ToList();

            if (childNodes.Any() && childNodes.Any(node =>
            {
                if (node is ConstructorInitializerSyntax)
                {
                    var constructorInitializer = (ConstructorInitializerSyntax) node;

                    // we must return false (to avoid the parent if) only if it is the base keyword
                    // and there are no arguments.
                    return !constructorInitializer.ThisOrBaseKeyword.IsKind(SyntaxKind.BaseKeyword) ||
                           constructorInitializer.ArgumentList.Arguments.Any();
                }

                return false;
            }))
            {
                return;
            }

            context.ReportDiagnostic(Diagnostic.Create(Rule, constructorDeclaration.GetLocation(),
                constructorDeclaration.Identifier));
        }

Microsoft.CodeAnalysis.CSharp.Syntax.ConstructorInitializerSyntax : IFormattable

Methods :

public SyntaxToken get_ColonToken()
public SyntaxToken get_ThisOrBaseKeyword()
public ArgumentListSyntax get_ArgumentList()
public Void Accept(CSharpSyntaxVisitor visitor = )
public TResult Accept(CSharpSyntaxVisitor<TResult> visitor = )
public ConstructorInitializerSyntax Update(SyntaxToken colonToken = , SyntaxToken thisOrBaseKeyword = , ArgumentListSyntax argumentList = )
public ConstructorInitializerSyntax WithColonToken(SyntaxToken colonToken = )
public ConstructorInitializerSyntax WithThisOrBaseKeyword(SyntaxToken thisOrBaseKeyword = )
public ConstructorInitializerSyntax WithArgumentList(ArgumentListSyntax argumentList = )
public ConstructorInitializerSyntax AddArgumentListArguments(ArgumentSyntax[] items = )
public SyntaxKind Kind()
public String get_Language()
public SyntaxTriviaList GetLeadingTrivia()
public SyntaxTriviaList GetTrailingTrivia()
public Location GetLocation()
public IEnumerable<Diagnostic> GetDiagnostics()
public DirectiveTriviaSyntax GetFirstDirective(Func<DirectiveTriviaSyntax, Boolean> predicate = null)
public DirectiveTriviaSyntax GetLastDirective(Func<DirectiveTriviaSyntax, Boolean> predicate = null)
public SyntaxToken GetFirstToken(Boolean includeZeroWidth = False, Boolean includeSkipped = False, Boolean includeDirectives = False, Boolean includeDocumentationComments = False)
public SyntaxToken GetLastToken(Boolean includeZeroWidth = False, Boolean includeSkipped = False, Boolean includeDirectives = False, Boolean includeDocumentationComments = False)
public SyntaxToken FindToken(Int32 position = , Boolean findInsideTrivia = False)
public SyntaxTrivia FindTrivia(Int32 position = , Func<SyntaxTrivia, Boolean> stepInto = )
public SyntaxTrivia FindTrivia(Int32 position = , Boolean findInsideTrivia = False)
public Boolean HasAnnotations(IEnumerable<String> annotationKinds = )
public Boolean HasAnnotation(SyntaxAnnotation annotation = )
public IEnumerable<SyntaxAnnotation> GetAnnotations(String annotationKind = )
public IEnumerable<SyntaxAnnotation> GetAnnotations(IEnumerable<String> annotationKinds = )
public IEnumerable<SyntaxNodeOrToken> GetAnnotatedNodesAndTokens(String annotationKind = )
public IEnumerable<SyntaxNodeOrToken> GetAnnotatedNodesAndTokens(String[] annotationKinds = )
public IEnumerable<SyntaxNodeOrToken> GetAnnotatedNodesAndTokens(SyntaxAnnotation annotation = )
public IEnumerable<SyntaxNode> GetAnnotatedNodes(SyntaxAnnotation syntaxAnnotation = )
public IEnumerable<SyntaxNode> GetAnnotatedNodes(String annotationKind = )
public IEnumerable<SyntaxToken> GetAnnotatedTokens(SyntaxAnnotation syntaxAnnotation = )
public IEnumerable<SyntaxToken> GetAnnotatedTokens(String annotationKind = )
public IEnumerable<SyntaxTrivia> GetAnnotatedTrivia(String annotationKind = )
public IEnumerable<SyntaxTrivia> GetAnnotatedTrivia(String[] annotationKinds = )
public IEnumerable<SyntaxTrivia> GetAnnotatedTrivia(SyntaxAnnotation annotation = )
public T CopyAnnotationsTo(T node = )
public Boolean IsEquivalentTo(SyntaxNode node = , Boolean topLevel = False)
public Void SerializeTo(Stream stream = , CancellationToken cancellationToken = null)
public Int32 get_RawKind()
public SyntaxTree get_SyntaxTree()
public TextSpan get_FullSpan()
public TextSpan get_Span()
public Int32 get_SpanStart()
public String ToString()
public String ToFullString()
public Void WriteTo(TextWriter writer = )
public SourceText GetText(Encoding encoding = null, SourceHashAlgorithm checksumAlgorithm = Sha1)
public Boolean IsEquivalentTo(SyntaxNode other = )
public Boolean IsIncrementallyIdenticalTo(SyntaxNode other = )
public Boolean get_IsMissing()
public Boolean IsPartOfStructuredTrivia()
public Boolean get_IsStructuredTrivia()
public Boolean get_HasStructuredTrivia()
public Boolean get_ContainsSkippedText()
public Boolean get_ContainsDirectives()
public Boolean get_ContainsDiagnostics()
public Boolean Contains(SyntaxNode node = )
public Boolean get_HasLeadingTrivia()
public Boolean get_HasTrailingTrivia()
public Location GetLocation()
public IEnumerable<Diagnostic> GetDiagnostics()
public SyntaxReference GetReference()
public SyntaxNode get_Parent()
public SyntaxTrivia get_ParentTrivia()
public ChildSyntaxList ChildNodesAndTokens()
public SyntaxNodeOrToken ChildThatContainsPosition(Int32 position = )
public IEnumerable<SyntaxNode> ChildNodes()
public IEnumerable<SyntaxNode> Ancestors(Boolean ascendOutOfTrivia = True)
public IEnumerable<SyntaxNode> AncestorsAndSelf(Boolean ascendOutOfTrivia = True)
public TNode FirstAncestorOrSelf(Func<TNode, Boolean> predicate = null, Boolean ascendOutOfTrivia = True)
public TNode FirstAncestorOrSelf(Func<TNode, TArg, Boolean> predicate = , TArg argument = , Boolean ascendOutOfTrivia = True)
public IEnumerable<SyntaxNode> DescendantNodes(Func<SyntaxNode, Boolean> descendIntoChildren = null, Boolean descendIntoTrivia = False)
public IEnumerable<SyntaxNode> DescendantNodes(TextSpan span = , Func<SyntaxNode, Boolean> descendIntoChildren = null, Boolean descendIntoTrivia = False)
public IEnumerable<SyntaxNode> DescendantNodesAndSelf(Func<SyntaxNode, Boolean> descendIntoChildren = null, Boolean descendIntoTrivia = False)
public IEnumerable<SyntaxNode> DescendantNodesAndSelf(TextSpan span = , Func<SyntaxNode, Boolean> descendIntoChildren = null, Boolean descendIntoTrivia = False)
public IEnumerable<SyntaxNodeOrToken> DescendantNodesAndTokens(Func<SyntaxNode, Boolean> descendIntoChildren = null, Boolean descendIntoTrivia = False)
public IEnumerable<SyntaxNodeOrToken> DescendantNodesAndTokens(TextSpan span = , Func<SyntaxNode, Boolean> descendIntoChildren = null, Boolean descendIntoTrivia = False)
public IEnumerable<SyntaxNodeOrToken> DescendantNodesAndTokensAndSelf(Func<SyntaxNode, Boolean> descendIntoChildren = null, Boolean descendIntoTrivia = False)
public IEnumerable<SyntaxNodeOrToken> DescendantNodesAndTokensAndSelf(TextSpan span = , Func<SyntaxNode, Boolean> descendIntoChildren = null, Boolean descendIntoTrivia = False)
public SyntaxNode FindNode(TextSpan span = , Boolean findInsideTrivia = False, Boolean getInnermostNodeForTie = False)
public SyntaxToken FindToken(Int32 position = , Boolean findInsideTrivia = False)
public SyntaxToken GetFirstToken(Boolean includeZeroWidth = False, Boolean includeSkipped = False, Boolean includeDirectives = False, Boolean includeDocumentationComments = False)
public SyntaxToken GetLastToken(Boolean includeZeroWidth = False, Boolean includeSkipped = False, Boolean includeDirectives = False, Boolean includeDocumentationComments = False)
public IEnumerable<SyntaxToken> ChildTokens()
public IEnumerable<SyntaxToken> DescendantTokens(Func<SyntaxNode, Boolean> descendIntoChildren = null, Boolean descendIntoTrivia = False)
public IEnumerable<SyntaxToken> DescendantTokens(TextSpan span = , Func<SyntaxNode, Boolean> descendIntoChildren = null, Boolean descendIntoTrivia = False)
public SyntaxTriviaList GetLeadingTrivia()
public SyntaxTriviaList GetTrailingTrivia()
public SyntaxTrivia FindTrivia(Int32 position = , Boolean findInsideTrivia = False)
public SyntaxTrivia FindTrivia(Int32 position = , Func<SyntaxTrivia, Boolean> stepInto = )
public IEnumerable<SyntaxTrivia> DescendantTrivia(Func<SyntaxNode, Boolean> descendIntoChildren = null, Boolean descendIntoTrivia = False)
public IEnumerable<SyntaxTrivia> DescendantTrivia(TextSpan span = , Func<SyntaxNode, Boolean> descendIntoChildren = null, Boolean descendIntoTrivia = False)
public Boolean get_ContainsAnnotations()
public Boolean HasAnnotations(String annotationKind = )
public Type GetType()
public Boolean Equals(Object obj = )
public Int32 GetHashCode()