[vala/staging: 2/5] codegen: Move and make a few methods to static functions



commit cc034f3b148b6efdbd424c1eeb984876d8cac420
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Mon Mar 18 12:43:02 2019 +0100

    codegen: Move and make a few methods to static functions

 codegen/valaccode.vala                 | 22 ++++++++++++++++++++++
 codegen/valaccodebasemodule.vala       | 22 ----------------------
 codegen/valaccodemethodcallmodule.vala |  2 +-
 codegen/valagsignalmodule.vala         |  2 +-
 4 files changed, 24 insertions(+), 24 deletions(-)
---
diff --git a/codegen/valaccode.vala b/codegen/valaccode.vala
index 1fe2a38fc..a9b93ce18 100644
--- a/codegen/valaccode.vala
+++ b/codegen/valaccode.vala
@@ -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);
        }
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala
index 4156315e3..68fc3e988 100644
--- a/codegen/valaccodebasemodule.vala
+++ b/codegen/valaccodebasemodule.vala
@@ -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)));
        }
diff --git a/codegen/valaccodemethodcallmodule.vala b/codegen/valaccodemethodcallmodule.vala
index 3d4d67640..6b292b8c0 100644
--- a/codegen/valaccodemethodcallmodule.vala
+++ b/codegen/valaccodemethodcallmodule.vala
@@ -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;
                        }
                }
diff --git a/codegen/valagsignalmodule.vala b/codegen/valagsignalmodule.vala
index 822519030..f87a4e0dc 100644
--- a/codegen/valagsignalmodule.vala
+++ b/codegen/valagsignalmodule.vala
@@ -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) {


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