]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
codegen: Move and make a few methods to static functions
authorRico Tzschichholz <ricotz@ubuntu.com>
Mon, 18 Mar 2019 11:43:02 +0000 (12:43 +0100)
committerRico Tzschichholz <ricotz@ubuntu.com>
Tue, 19 Mar 2019 07:50:49 +0000 (08:50 +0100)
codegen/valaccode.vala
codegen/valaccodebasemodule.vala
codegen/valaccodemethodcallmodule.vala
codegen/valagsignalmodule.vala

index 1fe2a38fce66c13784b6c6bc3b00eef9db0254a2..a9b93ce18e438cfc6667098d7d27f8f6da90d666 100644 (file)
@@ -163,6 +163,24 @@ namespace Vala {
                }
        }
 
+       public static bool is_ref_function_void (DataType type) {
+               unowned Class? cl = type.data_type as Class;
+               if (cl != null) {
+                       return get_ccode_ref_function_void (cl);
+               } else {
+                       return false;
+               }
+       }
+
+       public static bool is_free_function_address_of (DataType type) {
+               unowned Class? cl = type.data_type as Class;
+               if (cl != null) {
+                       return get_ccode_free_function_address_of (cl);
+               } else {
+                       return false;
+               }
+       }
+
        public static bool get_ccode_ref_function_void (Class cl) {
                return get_ccode_attribute(cl).ref_function_void;
        }
@@ -413,6 +431,10 @@ namespace Vala {
                return p.get_attribute ("ConcreteAccessor") != null;
        }
 
+       public static bool get_ccode_has_emitter (Signal sig) {
+               return sig.get_attribute ("HasEmitter") != null;
+       }
+
        public static bool get_ccode_has_type_id (TypeSymbol sym) {
                return sym.get_attribute_bool ("CCode", "has_type_id", true);
        }
index 4156315e39192c45d2751e8ce243d6fc0ecb1621..68fc3e988a187d4cbc8032dda62d7d231000a7d5 100644 (file)
@@ -4382,24 +4382,6 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                return true;
        }
 
-       bool is_ref_function_void (DataType type) {
-               var cl = type.data_type as Class;
-               if (cl != null) {
-                       return get_ccode_ref_function_void (cl);
-               } else {
-                       return false;
-               }
-       }
-
-       bool is_free_function_address_of (DataType type) {
-               var cl = type.data_type as Class;
-               if (cl != null) {
-                       return get_ccode_free_function_address_of (cl);
-               } else {
-                       return false;
-               }
-       }
-
        public virtual TargetValue? copy_value (TargetValue value, CodeNode node) {
                var type = value.value_type;
                var cexpr = get_cvalue_ (value);
@@ -6480,10 +6462,6 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                return new CCodeConstant ("\"%s%s\"".printf (get_ccode_name (sig), (detail != null ? "::%s".printf (detail) : "")));
        }
 
-       public bool get_signal_has_emitter (Signal sig) {
-               return sig.get_attribute ("HasEmitter") != null;
-       }
-
        public CCodeConstant get_property_canonical_cconstant (Property prop) {
                return new CCodeConstant ("\"%s\"".printf (get_ccode_name (prop)));
        }
index 3d4d67640194915d2c0836f042c3e4047adb8a64..6b292b8c001562a09c7cc0069015745e49885135 100644 (file)
@@ -666,7 +666,7 @@ public class Vala.CCodeMethodCallModule : CCodeAssignmentModule {
 
                        if (ma != null && ma.inner is BaseAccess && sig.is_virtual) {
                                // normal return value for base access
-                       } else if (!get_signal_has_emitter (sig) || ma.source_reference.file == sig.source_reference.file) {
+                       } else if (!get_ccode_has_emitter (sig) || ma.source_reference.file == sig.source_reference.file) {
                                return_result_via_out_param = true;
                        }
                }
index 822519030173c191aa8509dde8d8c0d8956383c6..f87a4e0dc81fcec362830ee8be44cff8cc456a77 100644 (file)
@@ -545,7 +545,7 @@ public class Vala.GSignalModule : GObjectModule {
                                ccall.add_argument (new CCodeConstant ("0"));
 
                                set_cvalue (expr, ccall);
-                       } else if (get_signal_has_emitter (sig)) {
+                       } else if (get_ccode_has_emitter (sig)) {
                                string emitter_func;
                                if (sig.emitter != null) {
                                        if (!sig.external_package && expr.source_reference.file != sig.source_reference.file) {