From dbac9e36fa3cea626cca1f7e3bdc1229dfc5804d Mon Sep 17 00:00:00 2001 From: triton Date: Tue, 17 Dec 2013 19:13:15 +0000 Subject: [PATCH] Fixed the generator to use blocks for templates and variables. Fixes wrong whitespace between those declarations. --- src/Generator/Generators/CLI/CLIHeadersTemplate.cs | 8 ++++++++ src/Generator/Generators/CLI/CLITextTemplate.cs | 2 ++ 2 files changed, 10 insertions(+) diff --git a/src/Generator/Generators/CLI/CLIHeadersTemplate.cs b/src/Generator/Generators/CLI/CLIHeadersTemplate.cs index 6806f651..e9893f0b 100644 --- a/src/Generator/Generators/CLI/CLIHeadersTemplate.cs +++ b/src/Generator/Generators/CLI/CLIHeadersTemplate.cs @@ -317,6 +317,8 @@ namespace CppSharp.Generators.CLI var functionTemplate = template as FunctionTemplate; if (functionTemplate == null) continue; + PushBlock(CLIBlockKind.Template); + var function = functionTemplate.TemplatedFunction; var typeCtx = new CLITypePrinterContext() @@ -339,6 +341,8 @@ namespace CppSharp.Generators.CLI WriteLine("generic<{0}>", typeNamesStr); WriteLine("{0} {1}({2});", retType, SafeIdentifier(function.Name), GenerateParametersList(function.Parameters)); + + PopBlock(NewLineKind.BeforeNextBlock); } PopIndent(); @@ -484,6 +488,8 @@ namespace CppSharp.Generators.CLI var type = variable.Type; + PushBlock(CLIBlockKind.Variable); + WriteLine("static property {0} {1}", type, variable.Name); WriteStartBraceIndent(); @@ -494,6 +500,8 @@ namespace CppSharp.Generators.CLI WriteLine("void set({0});", type); WriteCloseBraceIndent(); + + PopBlock(NewLineKind.BeforeNextBlock); } PopIndent(); diff --git a/src/Generator/Generators/CLI/CLITextTemplate.cs b/src/Generator/Generators/CLI/CLITextTemplate.cs index 657a5f1d..0521a070 100644 --- a/src/Generator/Generators/CLI/CLITextTemplate.cs +++ b/src/Generator/Generators/CLI/CLITextTemplate.cs @@ -41,6 +41,8 @@ namespace CppSharp.Generators.CLI public const int Function = BlockKind.LAST + 12; public const int Property = BlockKind.LAST + 13; public const int Typedef = BlockKind.LAST + 14; + public const int Variable = BlockKind.LAST + 15; + public const int Template = BlockKind.LAST + 16; } ///