]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
vala: Add delegate_target_type and delegate_target_destroy_type to SemanticAnalyzer
authorRico Tzschichholz <ricotz@ubuntu.com>
Wed, 2 Oct 2019 17:07:17 +0000 (19:07 +0200)
committerRico Tzschichholz <ricotz@ubuntu.com>
Thu, 3 Oct 2019 13:15:31 +0000 (15:15 +0200)
This is a plain copy from CCodeBaseModule.

vala/valasemanticanalyzer.vala

index 5ffef23e9f20cc4bab21499e03228073421471e0..bb4f9b744d4f99d00b88187ee0b85057c493ee48 100644 (file)
@@ -167,6 +167,10 @@ public class Vala.SemanticAnalyzer : CodeVisitor {
        public DataType list_type;
        public DataType tuple_type;
        public Class gsource_type;
+       public DataType delegate_target_type;
+       public DelegateType delegate_target_destroy_type;
+
+       Delegate destroy_notify;
 
        // keep replaced alive to make sure they remain valid
        // for the whole execution of CodeNode.accept
@@ -228,6 +232,17 @@ public class Vala.SemanticAnalyzer : CodeVisitor {
                        regex_type = new ObjectType ((Class) root_symbol.scope.lookup ("GLib").scope.lookup ("Regex"));
 
                        gsource_type = (Class) glib_ns.scope.lookup ("Source");
+
+                       delegate_target_type = new StructValueType ((Struct) glib_ns.scope.lookup ("pointer"));
+                       destroy_notify = (Delegate) glib_ns.scope.lookup ("DestroyNotify");
+                       delegate_target_destroy_type = new DelegateType (destroy_notify);
+               } else {
+                       delegate_target_type = new PointerType (new VoidType ());
+                       destroy_notify = new Delegate ("ValaDestroyNotify", new VoidType ());
+                       destroy_notify.add_parameter (new Parameter ("data", new PointerType (new VoidType ())));
+                       destroy_notify.has_target = false;
+                       destroy_notify.owner = context.root.scope;
+                       delegate_target_destroy_type = new DelegateType (destroy_notify);
                }
 
                current_symbol = root_symbol;