Browse Source

Fix `GetEffectiveNamespace` not going up the tree properly (#1909)

Also replaced recursion with while loop
pull/1900/head
Jelle 5 months ago committed by GitHub
parent
commit
cbaf344398
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  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