public static ConversionOperatorDeclarationSyntax InsertModifier(ConversionOperatorDeclarationSyntax conversionOperatorDeclaration, SyntaxKind modifierKind) { if (conversionOperatorDeclaration == null) { throw new ArgumentNullException(nameof(conversionOperatorDeclaration)); } return(conversionOperatorDeclaration.WithModifiers(InsertModifier(conversionOperatorDeclaration.Modifiers, modifierKind))); }
public override SyntaxNode VisitConversionOperatorDeclaration(ConversionOperatorDeclarationSyntax node) { if (!ShouldPublicize(node.AttributeLists)) { return(base.VisitConversionOperatorDeclaration(node)); } logger("Publicize conversion operator '{0}'", node.OperatorKeyword.Text); return(node .WithModifiers(MakePublic(node.Modifiers))); }
public static ConversionOperatorDeclarationSyntax InsertModifier(ConversionOperatorDeclarationSyntax conversionOperatorDeclaration, SyntaxToken modifier, IModifierComparer comparer) { if (conversionOperatorDeclaration == null) { throw new ArgumentNullException(nameof(conversionOperatorDeclaration)); } SyntaxTokenList modifiers = conversionOperatorDeclaration.Modifiers; if (!modifiers.Any()) { SyntaxToken implicitOrExplicitKeyword = conversionOperatorDeclaration.ImplicitOrExplicitKeyword; return(conversionOperatorDeclaration .WithImplicitOrExplicitKeyword(implicitOrExplicitKeyword.WithoutLeadingTrivia()) .WithModifiers(TokenList(modifier.WithLeadingTrivia(implicitOrExplicitKeyword.LeadingTrivia)))); } return(conversionOperatorDeclaration.WithModifiers(modifiers.InsertModifier(modifier, comparer))); }