Browse Source

Refactored the internal function generation code to collect all the declarations first and only then generate the needed functions. We also store them in a set to deal with duplicated entries.

pull/1/head
triton 12 years ago
parent
commit
5dce147d77
  1. 12
      src/Generator/Generators/CSharp/CSharpTextTemplate.cs

12
src/Generator/Generators/CSharp/CSharpTextTemplate.cs

@ -335,6 +335,8 @@ namespace CppSharp.Generators.CSharp @@ -335,6 +335,8 @@ namespace CppSharp.Generators.CSharp
GenerateClassFields(@class, isInternal: true);
var functions = new HashSet<Function>();
foreach (var ctor in @class.Constructors)
{
if (ctor.IsCopyConstructor || ctor.IsMoveConstructor)
@ -343,8 +345,7 @@ namespace CppSharp.Generators.CSharp @@ -343,8 +345,7 @@ namespace CppSharp.Generators.CSharp
if (ctor.IsPure)
continue;
NewLineIfNeeded();
GenerateInternalFunction(ctor);
functions.Add(ctor);
}
foreach (var method in @class.Methods)
@ -361,8 +362,13 @@ namespace CppSharp.Generators.CSharp @@ -361,8 +362,13 @@ namespace CppSharp.Generators.CSharp
if (method.IsPure)
continue;
functions.Add(method);
}
foreach (var function in functions)
{
NewLineIfNeeded();
GenerateInternalFunction(method);
GenerateInternalFunction(function);
}
typePrinter.PopContext();

Loading…
Cancel
Save