|
|
@ -97,7 +97,13 @@ namespace CppSharp.Generators.CLI |
|
|
|
// Create a new tree of namespaces out of the type references found.
|
|
|
|
// Create a new tree of namespaces out of the type references found.
|
|
|
|
var rootNamespace = new TranslationUnit(); |
|
|
|
var rootNamespace = new TranslationUnit(); |
|
|
|
|
|
|
|
|
|
|
|
foreach (var typeRef in typeReferences) |
|
|
|
var sortedRefs = typeReferences.ToList(); |
|
|
|
|
|
|
|
sortedRefs.Sort((ref1, ref2) => |
|
|
|
|
|
|
|
string.CompareOrdinal(ref1.FowardReference, ref2.FowardReference)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var forwardRefs = new SortedSet<string>(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
foreach (var typeRef in sortedRefs) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (string.IsNullOrWhiteSpace(typeRef.FowardReference)) |
|
|
|
if (string.IsNullOrWhiteSpace(typeRef.FowardReference)) |
|
|
|
continue; |
|
|
|
continue; |
|
|
@ -106,6 +112,12 @@ namespace CppSharp.Generators.CLI |
|
|
|
if (!(declaration.Namespace is Namespace)) |
|
|
|
if (!(declaration.Namespace is Namespace)) |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!forwardRefs.Add(typeRef.FowardReference)) |
|
|
|
|
|
|
|
continue; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (typeRef.Include.InHeader) |
|
|
|
|
|
|
|
continue; |
|
|
|
|
|
|
|
|
|
|
|
var @namespace = FindCreateNamespace(rootNamespace, declaration); |
|
|
|
var @namespace = FindCreateNamespace(rootNamespace, declaration); |
|
|
|
@namespace.TypeReferences.Add(typeRef); |
|
|
|
@namespace.TypeReferences.Add(typeRef); |
|
|
|
} |
|
|
|
} |
|
|
|