[vala/staging: 1/2] gtkmodule: Recurse inner classes of ObjectTypeSymbols




commit a1a8b3f80e9e764ceb2795285c20e18d25b6be97
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Wed Feb 9 00:05:24 2022 +0100

    gtkmodule: Recurse inner classes of ObjectTypeSymbols

 codegen/valagtkmodule.vala | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)
---
diff --git a/codegen/valagtkmodule.vala b/codegen/valagtkmodule.vala
index cf7d26b55..c0d98631c 100644
--- a/codegen/valagtkmodule.vala
+++ b/codegen/valagtkmodule.vala
@@ -79,14 +79,23 @@ public class Vala.GtkModule : GSignalModule {
                recurse_cclass_to_vala_map (context.root);
        }
 
-       private void recurse_cclass_to_vala_map (Namespace ns) {
-               foreach (var cl in ns.get_classes()) {
+       private void recurse_cclass_to_vala_map (Symbol sym) {
+               unowned List<Class> classes;
+               if (sym is Namespace) {
+                       foreach (var inner in ((Namespace) sym).get_namespaces()) {
+                               recurse_cclass_to_vala_map (inner);
+                       }
+                       classes = ((Namespace) sym).get_classes ();
+               } else if (sym is ObjectTypeSymbol) {
+                       classes = ((ObjectTypeSymbol) sym).get_classes ();
+               } else {
+                       return;
+               }
+               foreach (var cl in classes) {
                        if (!cl.is_compact) {
                                cclass_to_vala_map.set (get_ccode_name (cl), cl);
                        }
-               }
-               foreach (var inner in ns.get_namespaces()) {
-                       recurse_cclass_to_vala_map (inner);
+                       recurse_cclass_to_vala_map (cl);
                }
        }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]