Browse Source

Fixed the generated C++/CLI when a header and a contained name-space bear the same name.

Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
pull/719/head
Dimitar Dobrev 9 years ago
parent
commit
055f4c627e
  1. 2
      src/Generator/Generators/CLI/CLIHeaders.cs
  2. 14
      src/Generator/Generators/CLI/CLISources.cs
  3. 4
      tests/Common/AnotherUnit.cpp

2
src/Generator/Generators/CLI/CLIHeaders.cs

@ -177,7 +177,7 @@ namespace CppSharp.Generators.CLI @@ -177,7 +177,7 @@ namespace CppSharp.Generators.CLI
PopBlock(NewLineKind.BeforeNextBlock);
}
if (decl.HasFunctions)
if (decl.Functions.Any(f => f.IsGenerated))
GenerateFunctions(decl);
foreach (var childNamespace in decl.Namespaces)

14
src/Generator/Generators/CLI/CLISources.cs

@ -95,17 +95,11 @@ namespace CppSharp.Generators.CLI @@ -95,17 +95,11 @@ namespace CppSharp.Generators.CLI
GenerateClass(@class);
}
if (@namespace.HasFunctions)
// Generate all the function declarations for the module.
foreach (var function in @namespace.Functions.Where(f => f.IsGenerated))
{
// Generate all the function declarations for the module.
foreach (var function in @namespace.Functions)
{
if (!function.IsGenerated)
continue;
GenerateFunction(function, @namespace);
NewLine();
}
GenerateFunction(function, @namespace);
NewLine();
}
if (Options.GenerateFunctionTemplates)

4
tests/Common/AnotherUnit.cpp

@ -7,3 +7,7 @@ void DelegateNamespace::Nested::f3(void (*)()) @@ -7,3 +7,7 @@ void DelegateNamespace::Nested::f3(void (*)())
void DelegateNamespace::f4(void (*)())
{
}
void AnotherUnit::f()
{
}

Loading…
Cancel
Save