Browse Source

Fixed generation of nested declarations in classes (part 2).

pull/68/merge
triton 13 years ago
parent
commit
79d8528625
  1. 10
      src/Generator/Generators/CLI/CLISourcesTemplate.cs

10
src/Generator/Generators/CLI/CLISourcesTemplate.cs

@ -44,7 +44,7 @@ namespace CppSharp.Generators.CLI
NewLine(); NewLine();
PopBlock(); PopBlock();
GenerateNamespace(TranslationUnit); GenerateDeclContext(TranslationUnit);
PushBlock(BlockKind.Footer); PushBlock(BlockKind.Footer);
PopBlock(); PopBlock();
@ -75,7 +75,7 @@ namespace CppSharp.Generators.CLI
PopBlock(); PopBlock();
} }
private void GenerateNamespace(Namespace @namespace) private void GenerateDeclContext(DeclarationContext @namespace)
{ {
PushBlock(CLIBlockKind.Namespace); PushBlock(CLIBlockKind.Namespace);
foreach (var @class in @namespace.Classes) foreach (var @class in @namespace.Classes)
@ -103,7 +103,7 @@ namespace CppSharp.Generators.CLI
} }
foreach(var childNamespace in @namespace.Namespaces) foreach(var childNamespace in @namespace.Namespaces)
GenerateNamespace(childNamespace); GenerateDeclContext(childNamespace);
PopBlock(); PopBlock();
} }
@ -112,6 +112,8 @@ namespace CppSharp.Generators.CLI
{ {
PushBlock(CLIBlockKind.Class); PushBlock(CLIBlockKind.Class);
GenerateDeclContext(@class);
// Output a default constructor that takes the native pointer. // Output a default constructor that takes the native pointer.
GenerateClassConstructor(@class, isIntPtr: false); GenerateClassConstructor(@class, isIntPtr: false);
GenerateClassConstructor(@class, isIntPtr: true); GenerateClassConstructor(@class, isIntPtr: true);
@ -690,7 +692,7 @@ namespace CppSharp.Generators.CLI
} }
} }
public void GenerateFunction(Function function, Namespace @namespace) public void GenerateFunction(Function function, DeclarationContext @namespace)
{ {
if (function.Ignore) if (function.Ignore)
return; return;

Loading…
Cancel
Save