From d3d7e1f2d6559043d26bed9e76d1d49733ca4be8 Mon Sep 17 00:00:00 2001 From: triton Date: Sat, 18 May 2013 15:37:43 +0100 Subject: [PATCH] Use the regular templates since classes are now regular declaration contexts and they do not have a separate container for FunctionTemplates. --- src/Generator/Generators/CLI/CLIHeadersTemplate.cs | 7 +++++-- src/Generator/Generators/CLI/CLISourcesTemplate.cs | 10 ++++++---- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/Generator/Generators/CLI/CLIHeadersTemplate.cs b/src/Generator/Generators/CLI/CLIHeadersTemplate.cs index 36d7b6fc..07c68c7c 100644 --- a/src/Generator/Generators/CLI/CLIHeadersTemplate.cs +++ b/src/Generator/Generators/CLI/CLIHeadersTemplate.cs @@ -262,11 +262,14 @@ namespace CppSharp.Generators.CLI var oldCtx = printer.Context; PushIndent(); - foreach (var template in @class.FunctionTemplates) + foreach (var template in @class.Templates) { if (template.Ignore) continue; - var function = template.TemplatedFunction; + var functionTemplate = template as FunctionTemplate; + if (functionTemplate == null) continue; + + var function = functionTemplate.TemplatedFunction; var typeNames = template.Parameters.Select( param => "typename " + param.Name).ToList(); diff --git a/src/Generator/Generators/CLI/CLISourcesTemplate.cs b/src/Generator/Generators/CLI/CLISourcesTemplate.cs index 31c8bbda..2fff749c 100644 --- a/src/Generator/Generators/CLI/CLISourcesTemplate.cs +++ b/src/Generator/Generators/CLI/CLISourcesTemplate.cs @@ -161,13 +161,15 @@ namespace CppSharp.Generators.CLI if (Options.GenerateFunctionTemplates) { - foreach (var template in @class.FunctionTemplates) + foreach (var template in @class.Templates) { - if (template.Ignore) - continue; + if (template.Ignore) continue; + + var functionTemplate = template as FunctionTemplate; + if (functionTemplate == null) continue; GenerateDeclarationCommon(template); - GenerateFunctionTemplate(template, @class); + GenerateFunctionTemplate(functionTemplate, @class); } }