]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
codegen: More use of delegate_target_type and delegate_target_destroy_type
authorJeremy Philippe <jeremy.philippe@gmail.com>
Wed, 7 Oct 2020 11:41:40 +0000 (13:41 +0200)
committerRico Tzschichholz <ricotz@ubuntu.com>
Wed, 7 Oct 2020 11:41:40 +0000 (13:41 +0200)
codegen/valaccodebasemodule.vala
codegen/valaccodemethodcallmodule.vala

index e782a4a58f4a91419f398b8a56e66adaf3c22eee..dfbae93b455a8cd6617f914d0aa3e0b6436652ee 100644 (file)
@@ -338,7 +338,6 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
        public TypeSymbol gbytearray_type;
        public TypeSymbol gptrarray_type;
        public TypeSymbol gthreadpool_type;
-       public DataType gdestroynotify_type;
        public DataType gquark_type;
        public Struct gvalue_type;
        public Class gvariant_type;
@@ -504,7 +503,6 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                        gbytearray_type = (TypeSymbol) glib_ns.scope.lookup ("ByteArray");
                        gptrarray_type = (TypeSymbol) glib_ns.scope.lookup ("PtrArray");
                        gthreadpool_type = (TypeSymbol) glib_ns.scope.lookup ("ThreadPool");
-                       gdestroynotify_type = new DelegateType ((Delegate) glib_ns.scope.lookup ("DestroyNotify"));
 
                        gerror = (Class) root_symbol.scope.lookup ("GLib").scope.lookup ("Error");
                        gquark_type = new IntegerType ((Struct) glib_ns.scope.lookup ("Quark"));
index e3293feb432ec45a23f309ce3ea8c3cda51d2237..2c5be10c3071cc3639e1771480556e89da89dfb2 100644 (file)
@@ -447,12 +447,12 @@ public class Vala.CCodeMethodCallModule : CCodeAssignmentModule {
                                                } else if (get_ccode_delegate_target (param) && param.variable_type is DelegateType) {
                                                        var deleg_type = (DelegateType) param.variable_type;
                                                        if (deleg_type.delegate_symbol.has_target) {
-                                                               temp_var = get_temp_variable (new PointerType (new VoidType ()), true, null, true);
+                                                               temp_var = get_temp_variable (delegate_target_type, true, null, true);
                                                                emit_temp_var (temp_var);
                                                                set_delegate_target (arg, get_variable_cexpression (temp_var.name));
                                                                carg_map.set (get_param_pos (get_ccode_delegate_target_pos (param)), new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, get_delegate_target (arg)));
                                                                if (deleg_type.is_disposable ()) {
-                                                                       temp_var = get_temp_variable (gdestroynotify_type, true, null, true);
+                                                                       temp_var = get_temp_variable (delegate_target_destroy_type, true, null, true);
                                                                        emit_temp_var (temp_var);
                                                                        set_delegate_target_destroy_notify (arg, get_variable_cexpression (temp_var.name));
                                                                        carg_map.set (get_param_pos (get_ccode_delegate_target_pos (param) + 0.01), new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, get_delegate_target_destroy_notify (arg)));
@@ -561,7 +561,7 @@ public class Vala.CCodeMethodCallModule : CCodeAssignmentModule {
                } else if (m != null && m.return_type is DelegateType && async_call != ccall) {
                        var deleg_type = (DelegateType) m.return_type;
                        if (get_ccode_delegate_target (m) && deleg_type.delegate_symbol.has_target) {
-                               var temp_var = get_temp_variable (new PointerType (new VoidType ()), true, null, true);
+                               var temp_var = get_temp_variable (delegate_target_type, true, null, true);
                                var temp_ref = get_variable_cexpression (temp_var.name);
 
                                emit_temp_var (temp_var);
@@ -571,7 +571,7 @@ public class Vala.CCodeMethodCallModule : CCodeAssignmentModule {
                                set_delegate_target (expr, temp_ref);
 
                                if (deleg_type.is_disposable ()) {
-                                       temp_var = get_temp_variable (gdestroynotify_type, true, null, true);
+                                       temp_var = get_temp_variable (delegate_target_destroy_type, true, null, true);
                                        temp_ref = get_variable_cexpression (temp_var.name);
 
                                        emit_temp_var (temp_var);
@@ -626,7 +626,7 @@ public class Vala.CCodeMethodCallModule : CCodeAssignmentModule {
                } else if (deleg != null && deleg.return_type is DelegateType && get_ccode_delegate_target (deleg)) {
                        var deleg_type = (DelegateType) deleg.return_type;
                        if (deleg_type.delegate_symbol.has_target) {
-                               var temp_var = get_temp_variable (new PointerType (new VoidType ()), true, null, true);
+                               var temp_var = get_temp_variable (delegate_target_type, true, null, true);
                                var temp_ref = get_variable_cexpression (temp_var.name);
 
                                emit_temp_var (temp_var);
@@ -636,7 +636,7 @@ public class Vala.CCodeMethodCallModule : CCodeAssignmentModule {
                                set_delegate_target (expr, temp_ref);
 
                                if (deleg_type.is_disposable ()) {
-                                       temp_var = get_temp_variable (gdestroynotify_type, true, null, true);
+                                       temp_var = get_temp_variable (delegate_target_type, true, null, true);
                                        temp_ref = get_variable_cexpression (temp_var.name);
 
                                        emit_temp_var (temp_var);