|
|
|
|
@ -3,20 +3,15 @@ using CppSharp.AST;
@@ -3,20 +3,15 @@ using CppSharp.AST;
|
|
|
|
|
|
|
|
|
|
namespace CppSharp.Passes |
|
|
|
|
{ |
|
|
|
|
class SortDeclarationsPass : TranslationUnitPass |
|
|
|
|
public class SortDeclarationsPass : TranslationUnitPass |
|
|
|
|
{ |
|
|
|
|
private static void SortDeclarations(Namespace @namespace) |
|
|
|
|
public override bool VisitNamespace(Namespace @namespace) |
|
|
|
|
{ |
|
|
|
|
@namespace.Declarations = @namespace.Declarations.OrderBy( |
|
|
|
|
declaration => declaration.DefinitionOrder).ToList(); |
|
|
|
|
|
|
|
|
|
foreach (var childNamespace in @namespace.Namespaces) |
|
|
|
|
SortDeclarations(childNamespace); |
|
|
|
|
} |
|
|
|
|
if (!base.VisitNamespace(@namespace) || @namespace.Ignore) |
|
|
|
|
return false; |
|
|
|
|
|
|
|
|
|
public override bool VisitTranslationUnit(TranslationUnit unit) |
|
|
|
|
{ |
|
|
|
|
SortDeclarations(unit); |
|
|
|
|
@namespace.Declarations = @namespace.Declarations.OrderBy( |
|
|
|
|
d => d.DefinitionOrder).ToList(); |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|