[vala/staging] codegen: Remove CCodeBaseModule.get_result_cexpression()



commit 1afce0351c0784db31deb6fe9caaeb6e4304fd9e
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Tue Jan 15 16:00:30 2019 +0100

    codegen: Remove CCodeBaseModule.get_result_cexpression()

 codegen/valaccodebasemodule.vala   | 22 +++++++++-------------
 codegen/valaccodemethodmodule.vala |  2 +-
 codegen/valagsignalmodule.vala     |  6 +++---
 3 files changed, 13 insertions(+), 17 deletions(-)
---
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala
index 6bee58cca..079fc3bc8 100644
--- a/codegen/valaccodebasemodule.vala
+++ b/codegen/valaccodebasemodule.vala
@@ -2075,7 +2075,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
 
                                if (get_this_type () != null && (!in_creation_method_with_chainup || 
current_method.body != b)) {
                                        var ref_call = new CCodeFunctionCall (get_dup_func_expression 
(get_data_type_for_symbol (current_type_symbol), b.source_reference));
-                                       ref_call.add_argument (get_result_cexpression ("self"));
+                                       ref_call.add_argument (get_this_cexpression ());
 
                                        // never increase reference count for self in finalizers to avoid 
infinite recursion on following unref
                                        var instance = (is_in_destructor () ? (CCodeExpression) new 
CCodeIdentifier ("self") : (CCodeExpression) ref_call);
@@ -2397,10 +2397,6 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                }
        }
 
-       public CCodeExpression get_result_cexpression (string cname = "result") {
-               return get_cexpression (cname);
-       }
-
        public bool is_simple_struct_creation (Variable variable, Expression expr) {
                var st = variable.variable_type.data_type as Struct;
                var creation = expr as ObjectCreationExpression;
@@ -2701,7 +2697,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                        }
 
                        if (is_in_generic_type ((GenericType) type) && !is_chainup && !in_creation_method) {
-                               return new CCodeMemberAccess.pointer (new CCodeMemberAccess.pointer 
(get_result_cexpression ("self"), "priv"), var_name);
+                               return new CCodeMemberAccess.pointer (new CCodeMemberAccess.pointer 
(get_this_cexpression (), "priv"), var_name);
                        } else {
                                return get_variable_cexpression (var_name);
                        }
@@ -2771,7 +2767,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                        }
 
                        if (is_in_generic_type ((GenericType) type) && !is_chainup && !in_creation_method) {
-                               return new CCodeMemberAccess.pointer (new CCodeMemberAccess.pointer 
(get_result_cexpression ("self"), "priv"), func_name);
+                               return new CCodeMemberAccess.pointer (new CCodeMemberAccess.pointer 
(get_this_cexpression (), "priv"), func_name);
                        } else {
                                return get_variable_cexpression (func_name);
                        }
@@ -3314,7 +3310,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                        }
 
                        if (is_in_generic_type ((GenericType) type) && !is_chainup && !in_creation_method) {
-                               return new CCodeMemberAccess.pointer (new CCodeMemberAccess.pointer 
(get_result_cexpression ("self"), "priv"), func_name);
+                               return new CCodeMemberAccess.pointer (new CCodeMemberAccess.pointer 
(get_this_cexpression (), "priv"), func_name);
                        } else {
                                return get_variable_cexpression (func_name);
                        }
@@ -3849,7 +3845,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
 
                        var array_type = (ArrayType) current_return_type;
                        for (int dim = 1; dim <= array_type.rank; dim++) {
-                               var len_l = get_result_cexpression (get_array_length_cname ("result", dim));
+                               var len_l = get_cexpression (get_array_length_cname ("result", dim));
                                var len_r = get_array_length_cvalue (temp_value, dim);
                                if (!is_in_coroutine ()) {
                                        ccode.open_if (len_l);
@@ -3867,14 +3863,14 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                        if (delegate_type.delegate_symbol.has_target) {
                                var temp_value = store_temp_value (stmt.return_expression.target_value, stmt);
 
-                               var target_l = get_result_cexpression (get_delegate_target_cname ("result"));
+                               var target_l = get_cexpression (get_delegate_target_cname ("result"));
                                if (!is_in_coroutine ()) {
                                        target_l = new CCodeUnaryExpression 
(CCodeUnaryOperator.POINTER_INDIRECTION, target_l);
                                }
                                var target_r = get_delegate_target_cvalue (temp_value);
                                ccode.add_assignment (target_l, target_r);
                                if (delegate_type.is_disposable ()) {
-                                       var target_l_destroy_notify = get_result_cexpression 
(get_delegate_target_destroy_notify_cname ("result"));
+                                       var target_l_destroy_notify = get_cexpression 
(get_delegate_target_destroy_notify_cname ("result"));
                                        if (!is_in_coroutine ()) {
                                                target_l_destroy_notify = new CCodeUnaryExpression 
(CCodeUnaryOperator.POINTER_INDIRECTION, target_l_destroy_notify);
                                        }
@@ -3888,7 +3884,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
 
                if (stmt.return_expression != null) {
                        // assign method result to `result'
-                       CCodeExpression result_lhs = get_result_cexpression ();
+                       CCodeExpression result_lhs = get_cexpression ("result");
                        if (current_return_type.is_real_non_null_struct_type () && !is_in_coroutine ()) {
                                result_lhs = new CCodeUnaryExpression 
(CCodeUnaryOperator.POINTER_INDIRECTION, result_lhs);
                        }
@@ -5897,7 +5893,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                        }
                        set_delegate_target (lambda, delegate_target);
                } else if (get_this_type () != null) {
-                       CCodeExpression delegate_target = get_result_cexpression ("self");
+                       CCodeExpression delegate_target = get_this_cexpression ();
                        delegate_target = convert_to_generic_pointer (delegate_target, get_this_type ());
                        if (expr_owned || delegate_type.is_called_once) {
                                var ref_call = new CCodeFunctionCall (get_dup_func_expression (get_this_type 
(), lambda.source_reference));
diff --git a/codegen/valaccodemethodmodule.vala b/codegen/valaccodemethodmodule.vala
index b247216c5..fc374e5cf 100644
--- a/codegen/valaccodemethodmodule.vala
+++ b/codegen/valaccodemethodmodule.vala
@@ -75,7 +75,7 @@ public abstract class Vala.CCodeMethodModule : CCodeStructModule {
                        var cparam = new CCodeParameter ("result", get_ccode_name (m.return_type) + "*");
                        cparam_map.set (get_param_pos (-3), cparam);
                        if (carg_map != null) {
-                               carg_map.set (get_param_pos (-3), get_result_cexpression ());
+                               carg_map.set (get_param_pos (-3), get_cexpression ("result"));
                        }
                } else if (get_ccode_array_length (m) && m.return_type is ArrayType) {
                        // return array length if appropriate
diff --git a/codegen/valagsignalmodule.vala b/codegen/valagsignalmodule.vala
index 562fc9cf6..3d0d19c2c 100644
--- a/codegen/valagsignalmodule.vala
+++ b/codegen/valagsignalmodule.vala
@@ -654,7 +654,7 @@ public class Vala.GSignalModule : GObjectModule {
                if (ma.inner != null) {
                        ccall.add_argument ((CCodeExpression) get_ccodenode (ma.inner));
                } else {
-                       ccall.add_argument (get_result_cexpression ("self"));
+                       ccall.add_argument (get_this_cexpression ());
                }
 
                if (sig is DynamicSignal) {
@@ -738,10 +738,10 @@ public class Vala.GSignalModule : GObjectModule {
                                if (right_ma.inner != null) {
                                        ccall.add_argument (get_cvalue (right_ma.inner));
                                } else {
-                                       ccall.add_argument (get_result_cexpression ("self"));
+                                       ccall.add_argument (get_this_cexpression ());
                                }
                        } else if (handler is LambdaExpression) {
-                               ccall.add_argument (get_result_cexpression ("self"));
+                               ccall.add_argument (get_this_cexpression ());
                        }
                        if (!disconnect && !(sig is DynamicSignal)
                            && in_gobject_instance (m)) {


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