From ca7ab54681593a25b51c118e9aba40f44adf3f3d Mon Sep 17 00:00:00 2001 From: Rico Tzschichholz Date: Wed, 2 Oct 2019 19:07:17 +0200 Subject: [PATCH] vala: Add delegate_target_type and delegate_target_destroy_type to SemanticAnalyzer This is a plain copy from CCodeBaseModule. --- vala/valasemanticanalyzer.vala | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/vala/valasemanticanalyzer.vala b/vala/valasemanticanalyzer.vala index 5ffef23e9..bb4f9b744 100644 --- a/vala/valasemanticanalyzer.vala +++ b/vala/valasemanticanalyzer.vala @@ -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; -- 2.47.2