From 95265deeb8f61253846ad44c256efcd513e07c2c Mon Sep 17 00:00:00 2001 From: Joao Matos Date: Wed, 15 Feb 2017 23:50:12 +0000 Subject: [PATCH] Move event and enum handling checks to their generation methods. --- src/Generator/Generators/CSharp/CSharpSources.cs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/Generator/Generators/CSharp/CSharpSources.cs b/src/Generator/Generators/CSharp/CSharpSources.cs index 2d27f2f3..6b6f97bb 100644 --- a/src/Generator/Generators/CSharp/CSharpSources.cs +++ b/src/Generator/Generators/CSharp/CSharpSources.cs @@ -222,9 +222,6 @@ namespace CppSharp.Generators.CSharp // Generate all the enum declarations. foreach (var @enum in context.Enums) { - if (@enum.IsIncomplete) - continue; - GenerateEnum(@enum); } @@ -282,8 +279,6 @@ namespace CppSharp.Generators.CSharp foreach (var @event in context.Events) { - if (!@event.IsGenerated) continue; - GenerateEvent(@event); } @@ -1781,6 +1776,9 @@ namespace CppSharp.Generators.CSharp private void GenerateEvent(Event @event) { + if (!@event.IsGenerated) + return; + PushBlock(CSharpBlockKind.Event, @event); TypePrinter.PushContext(TypePrinterContextKind.Native); var args = TypePrinter.VisitParameters(@event.Parameters, hasNames: true); @@ -3051,6 +3049,9 @@ namespace CppSharp.Generators.CSharp public void GenerateEnum(Enumeration @enum) { + if (@enum.IsIncomplete) + return; + PushBlock(CSharpBlockKind.Enum); GenerateDeclarationCommon(@enum);