Browse Source

Bunch of fixes to the new line generation.

pull/1/head
triton 12 years ago
parent
commit
7998b0f8c0
  1. 14
      src/Generator/Generators/CSharp/CSharpTextTemplate.cs

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

@ -155,7 +155,7 @@ namespace Cxxi.Generators.CSharp
if (!GenerateTypedef(typedef)) if (!GenerateTypedef(typedef))
continue; continue;
NewLine(); NewLineIfNeeded();
} }
// Generate all the struct/class declarations for the module. // Generate all the struct/class declarations for the module.
@ -428,8 +428,6 @@ namespace Cxxi.Generators.CSharp
} }
} }
ResetNewLine();
foreach (var field in @class.Fields) foreach (var field in @class.Fields)
{ {
if (CheckIgnoreField(@class, field)) continue; if (CheckIgnoreField(@class, field)) continue;
@ -541,7 +539,7 @@ namespace Cxxi.Generators.CSharp
public void GenerateClassMethods(Class @class) public void GenerateClassMethods(Class @class)
{ {
ResetNewLine(); NewLineIfNeeded();
var staticMethods = new List<Method>(); var staticMethods = new List<Method>();
foreach (var method in @class.Methods) foreach (var method in @class.Methods)
@ -579,8 +577,11 @@ namespace Cxxi.Generators.CSharp
public void GenerateClassConstructors(Class @class) public void GenerateClassConstructors(Class @class)
{ {
NewLineIfNeeded();
// Output a default constructor that takes the native pointer. // Output a default constructor that takes the native pointer.
GenerateNativeConstructor(@class); GenerateNativeConstructor(@class);
NeedNewLine();
foreach (var ctor in @class.Constructors) foreach (var ctor in @class.Constructors)
{ {
@ -591,8 +592,9 @@ namespace Cxxi.Generators.CSharp
if (ctor.Parameters.Count == 0 && @class.IsValueType) if (ctor.Parameters.Count == 0 && @class.IsValueType)
continue; continue;
NewLineIfNeeded();
GenerateMethod(ctor, @class); GenerateMethod(ctor, @class);
NewLine(); NeedNewLine();
} }
if (@class.IsRefType) if (@class.IsRefType)
@ -614,7 +616,7 @@ namespace Cxxi.Generators.CSharp
WriteLine("GC.SuppressFinalize(this);"); WriteLine("GC.SuppressFinalize(this);");
WriteCloseBraceIndent(); WriteCloseBraceIndent();
NewLine(); NeedNewLine();
} }
// Generate Dispose(bool) method // Generate Dispose(bool) method

Loading…
Cancel
Save