From 4f62b29bf4caf400cd10bffe6b3b49ca923fe95b Mon Sep 17 00:00:00 2001 From: Mike Wey Date: Wed, 24 Mar 2021 22:01:13 -0400 Subject: [PATCH] Use the correct class name in ImplementClass. and add the needed import for ObjectG. Fixes: #325 --- generated/gtkd/gtkd/Implement.d | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/generated/gtkd/gtkd/Implement.d b/generated/gtkd/gtkd/Implement.d index 9e827ad64..cae3b6ae3 100644 --- a/generated/gtkd/gtkd/Implement.d +++ b/generated/gtkd/gtkd/Implement.d @@ -87,6 +87,7 @@ template ImplementClassImpl(Klass, Impl) string result; result ~= "import glib.Str;\n"~ + "import gobject.ObjectG;\n"~ "import gobject.Type : Type;\n"~ "import gobject.c.functions : g_type_class_peek_parent, g_object_get_data;\n"; @@ -174,7 +175,10 @@ template ImplementClassImpl(Klass, Impl) !implements!Impl(toCamelCase!Impl() ~ names[i].capitalizeFirst) ) //TODO: __traits(isOverrideFunction, Foo.foo) ? { - result ~= "\t"~ toCamelCase!GtkClass() ~"."~ names[i] ~" = &"~ toCamelCase!Impl() ~ names[i].capitalizeFirst ~";\n"; + static if ( is(GtkClass == getClass!Klass) ) + result ~= "\tparentClass."~ names[i] ~" = &"~ toCamelCase!Impl() ~ names[i].capitalizeFirst ~";\n"; + else + result ~= "\t"~ toCamelCase!GtkClass() ~"."~ names[i] ~" = &"~ toCamelCase!Impl() ~ names[i].capitalizeFirst ~";\n"; } }