public override SyntaxNode VisitOperatorDeclaration(OperatorDeclarationSyntax node) { node = (OperatorDeclarationSyntax)base.VisitOperatorDeclaration(node); if (node.ExpressionBody != null) { return(SyntaxHelper.ToStatementBody(node).NormalizeWhitespace()); } return(node); }
public override SyntaxNode VisitPropertyDeclaration(PropertyDeclarationSyntax node) { node = (PropertyDeclarationSyntax)base.VisitPropertyDeclaration(node); var newNode = node; if (node.ExpressionBody != null) { newNode = SyntaxHelper.ToStatementBody(node).NormalizeWhitespace(); } return(newNode.Equals(node) ? node : newNode); }
public override SyntaxNode VisitAccessorList(AccessorListSyntax node) { node = (AccessorListSyntax)base.VisitAccessorList(node); if (node.Accessors.Any(a => a.ExpressionBody != null)) { var list = new List <AccessorDeclarationSyntax>(); foreach (var accessor in node.Accessors) { if (accessor != null && accessor.ExpressionBody != null) { list.Add(SyntaxHelper.ToStatementBody(accessor)); } else { list.Add(accessor); } } node = node.WithAccessors(SyntaxFactory.List(list)).NormalizeWhitespace(); } return(node); }