mirror of https://github.com/mono/CppSharp.git
2 changed files with 37 additions and 13 deletions
@ -0,0 +1,36 @@
@@ -0,0 +1,36 @@
|
||||
using Cxxi.Types; |
||||
|
||||
namespace Cxxi.Passes |
||||
{ |
||||
class SortDeclarationsPass : TranslationUnitPass |
||||
{ |
||||
public SortDeclarationsPass() |
||||
{ |
||||
|
||||
} |
||||
|
||||
private static void SortDeclarations(Namespace @namespace) |
||||
{ |
||||
@namespace.Classes.Sort((c, c1) => |
||||
(int)(c.DefinitionOrder - c1.DefinitionOrder)); |
||||
|
||||
foreach (var childNamespace in @namespace.Namespaces) |
||||
SortDeclarations(childNamespace); |
||||
} |
||||
|
||||
public override bool ProcessUnit(TranslationUnit unit) |
||||
{ |
||||
SortDeclarations(unit); |
||||
return true; |
||||
} |
||||
} |
||||
|
||||
public static class SortDeclarationsExtensions |
||||
{ |
||||
public static void SortDeclarations(this PassBuilder builder) |
||||
{ |
||||
var pass = new SortDeclarationsPass(); |
||||
builder.AddPass(pass); |
||||
} |
||||
} |
||||
} |
Loading…
Reference in new issue