public int Compare(SyntaxNodeSortInfo <PropertySyntax> x, SyntaxNodeSortInfo <PropertySyntax> y) { int val = x.Name.CompareTo(y.Name); if (val != 0) { return(val); } return(x.Index - y.Index); }
public override SyntaxNode VisitPropertyList(PropertyListSyntax node) { if ((this.NodeInSpan(node)) && (node.Properties != null) && (node.Properties.Count > 0) && (!node.ContainsDiagnostics)) { List <SyntaxNodeSortInfo <PropertySyntax> > list = SyntaxNodeSortInfo <PropertySyntax> .FromSyntaxList(node.Properties); list.Sort(new PropertyComparer()); SyntaxList <PropertySyntax> properties = SyntaxNodeSortInfo <PropertySyntax> .ToSyntaxList(list); node = node.WithProperties(properties); } return(base.VisitPropertyList(node)); }
public int Compare(SyntaxNodeSortInfo <ReportDataItemElementSyntax> x, SyntaxNodeSortInfo <ReportDataItemElementSyntax> y) { if ((x.Kind == y.Kind) && (x.Kind == ConvertedSyntaxKind.ReportColumn)) { return(_stringComparer.Compare(x.Name, y.Name)); } if (x.Kind == ConvertedSyntaxKind.ReportColumn) { return(-1); } if (y.Kind == ConvertedSyntaxKind.ReportColumn) { return(1); } return(x.Index - y.Index); }
public override SyntaxNode VisitReportDataItem(ReportDataItemSyntax node) { if ((this.NodeInSpan(node)) && (!node.ContainsDiagnostics)) { List <SyntaxNodeSortInfo <ReportDataItemElementSyntax> > list = SyntaxNodeSortInfo <ReportDataItemElementSyntax> .FromSyntaxList(node.Elements); if (list.Count > 1) { list.Sort(new ReportElementComparer()); List <ReportDataItemElementSyntax> elementsList = new List <ReportDataItemElementSyntax>(); for (int i = 0; i < list.Count; i++) { elementsList.Add(list[i].Node); } node = node.WithElements(SyntaxFactory.List <ReportDataItemElementSyntax>(elementsList)); } } return(base.VisitReportDataItem(node)); }