Browse Source

Fix `GetEffectiveNamespace` not going up the tree properly

Also replaced recursion with while loop
pull/1909/head
duckdoom5 5 months ago
parent
commit
2ccac3bdd4
  1. 11
      src/Generator/Generators/CLI/CLITypeReferences.cs

11
src/Generator/Generators/CLI/CLITypeReferences.cs

@ -71,14 +71,15 @@ namespace CppSharp.Generators.CLI @@ -71,14 +71,15 @@ namespace CppSharp.Generators.CLI
static Namespace GetEffectiveNamespace(Declaration decl)
{
if (decl == null || decl.Namespace == null)
if (decl == null)
return null;
var @namespace = decl.Namespace as Namespace;
if (@namespace != null)
return @namespace;
var declContext = decl.Namespace;
return GetEffectiveNamespace(@namespace);
while (declContext != null && declContext is not Namespace)
declContext = declContext.Namespace;
return declContext as Namespace;
}
public void Process(Namespace @namespace, bool filterNamespaces = false)

Loading…
Cancel
Save