]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
codegen: Rename coroutine data variable to _data_
authorLuca Bruno <lucabru@src.gnome.org>
Tue, 28 Jun 2011 08:06:44 +0000 (10:06 +0200)
committerLuca Bruno <lucabru@src.gnome.org>
Tue, 28 Jun 2011 08:06:44 +0000 (10:06 +0200)
codegen/valaccodebasemodule.vala
codegen/valaccodememberaccessmodule.vala
codegen/valaccodemethodcallmodule.vala
codegen/valaccodemethodmodule.vala
codegen/valagasyncmodule.vala
codegen/valagdbusclientmodule.vala

index 65010e107d2bcac3597b4a4a8de8a9a41bd2c783..84d7b3024edc5bc1d462dd6bf5bdad6b706710f6 100644 (file)
@@ -1807,7 +1807,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
 
                                        // async method is suspended while waiting for callback,
                                        // so we never need to care about memory management of async data
-                                       ccode.add_assignment (new CCodeMemberAccess.pointer (get_variable_cexpression ("_data%d_".printf (block_id)), "_async_data_"), new CCodeIdentifier ("data"));
+                                       ccode.add_assignment (new CCodeMemberAccess.pointer (get_variable_cexpression ("_data%d_".printf (block_id)), "_async_data_"), new CCodeIdentifier ("_data_"));
                                }
                        } else if (b.parent_symbol is PropertyAccessor) {
                                var acc = (PropertyAccessor) b.parent_symbol;
@@ -1988,7 +1988,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
 
        public CCodeExpression get_variable_cexpression (string name) {
                if (is_in_coroutine ()) {
-                       return new CCodeMemberAccess.pointer (new CCodeIdentifier ("data"), get_variable_cname (name));
+                       return new CCodeMemberAccess.pointer (new CCodeIdentifier ("_data_"), get_variable_cname (name));
                } else {
                        return new CCodeIdentifier (get_variable_cname (name));
                }
@@ -2014,7 +2014,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
 
        public CCodeExpression get_result_cexpression (string cname = "result") {
                if (is_in_coroutine ()) {
-                       return new CCodeMemberAccess.pointer (new CCodeIdentifier ("data"), cname);
+                       return new CCodeMemberAccess.pointer (new CCodeIdentifier ("_data_"), cname);
                } else {
                        return new CCodeIdentifier (cname);
                }
@@ -3588,7 +3588,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                CCodeExpression this_access;
                if (is_in_coroutine ()) {
                        // use closure
-                       this_access = new CCodeMemberAccess.pointer (new CCodeIdentifier ("data"), "self");
+                       this_access = new CCodeMemberAccess.pointer (new CCodeIdentifier ("_data_"), "self");
                } else {
                        this_access = new CCodeIdentifier ("self");
                }
index 4387a327d4f5cab3d935501514f0358f026dd85c..e3f7f29bda8a7f0d2903a8742f27c6192a855ef1 100644 (file)
@@ -100,7 +100,7 @@ public abstract class Vala.CCodeMemberAccessModule : CCodeControlFlowModule {
                                        var block = ((Method) m.parent_symbol).body;
                                        set_delegate_target (expr, new CCodeMemberAccess.pointer (get_variable_cexpression ("_data%d_".printf (get_block_id (block))), "_async_data_"));
                                } else {
-                                       set_delegate_target (expr, new CCodeIdentifier ("data"));
+                                       set_delegate_target (expr, new CCodeIdentifier ("_data_"));
                                }
                        } else if (expr.inner != null) {
                                // expr.inner is null in the special case of referencing the method in a constant initializer
@@ -379,9 +379,9 @@ public abstract class Vala.CCodeMemberAccessModule : CCodeControlFlowModule {
                                }
                        } else if (delegate_type != null && delegate_type.delegate_symbol.has_target) {
                                if (is_in_coroutine ()) {
-                                       result.delegate_target_cvalue = new CCodeMemberAccess.pointer (new CCodeIdentifier ("data"), get_delegate_target_cname (get_variable_cname (local.name)));
+                                       result.delegate_target_cvalue = new CCodeMemberAccess.pointer (new CCodeIdentifier ("_data_"), get_delegate_target_cname (get_variable_cname (local.name)));
                                        if (local.variable_type.value_owned) {
-                                               result.delegate_target_destroy_notify_cvalue = new CCodeMemberAccess.pointer (new CCodeIdentifier ("data"), get_delegate_target_destroy_notify_cname (get_variable_cname (local.name)));
+                                               result.delegate_target_destroy_notify_cvalue = new CCodeMemberAccess.pointer (new CCodeIdentifier ("_data_"), get_delegate_target_destroy_notify_cname (get_variable_cname (local.name)));
                                        }
                                } else {
                                        result.delegate_target_cvalue = new CCodeIdentifier (get_delegate_target_cname (get_variable_cname (local.name)));
@@ -415,7 +415,7 @@ public abstract class Vala.CCodeMemberAccessModule : CCodeControlFlowModule {
                if (param.name == "this") {
                        if (is_in_coroutine ()) {
                                // use closure
-                               result.cvalue = new CCodeMemberAccess.pointer (new CCodeIdentifier ("data"), "self");
+                               result.cvalue = new CCodeMemberAccess.pointer (new CCodeIdentifier ("_data_"), "self");
                        } else {
                                var st = result.value_type.data_type as Struct;
                                if (st != null && !st.is_simple_type ()) {
@@ -448,9 +448,9 @@ public abstract class Vala.CCodeMemberAccessModule : CCodeControlFlowModule {
                                // use closure
                                result.cvalue = get_variable_cexpression (param.name);
                                if (delegate_type != null && delegate_type.delegate_symbol.has_target) {
-                                       result.delegate_target_cvalue = new CCodeMemberAccess.pointer (new CCodeIdentifier ("data"), get_delegate_target_cname (get_variable_cname (param.name)));
+                                       result.delegate_target_cvalue = new CCodeMemberAccess.pointer (new CCodeIdentifier ("_data_"), get_delegate_target_cname (get_variable_cname (param.name)));
                                        if (delegate_type.value_owned) {
-                                               result.delegate_target_destroy_notify_cvalue = new CCodeMemberAccess.pointer (new CCodeIdentifier ("data"), get_delegate_target_destroy_notify_cname (get_variable_cname (param.name)));
+                                               result.delegate_target_destroy_notify_cvalue = new CCodeMemberAccess.pointer (new CCodeIdentifier ("_data_"), get_delegate_target_destroy_notify_cname (get_variable_cname (param.name)));
                                        }
                                }
                        } else {
index 845d928a4b2a9c0aea0f3ccbfa2b7730da7b6867..ddfb4fc7e2de0a938a3cc44cb06c9a0006377d3b 100644 (file)
@@ -115,7 +115,7 @@ public class Vala.CCodeMethodCallModule : CCodeAssignmentModule {
                                // output arguments used separately
                                out_arg_map = new HashMap<int,CCodeExpression> (direct_hash, direct_equal);
                                // pass GAsyncResult stored in closure to finish function
-                               out_arg_map.set (get_param_pos (0.1), new CCodeMemberAccess.pointer (new CCodeIdentifier ("data"), "_res_"));
+                               out_arg_map.set (get_param_pos (0.1), new CCodeMemberAccess.pointer (new CCodeIdentifier ("_data_"), "_res_"));
                        }
                }
 
@@ -172,7 +172,7 @@ public class Vala.CCodeMethodCallModule : CCodeAssignmentModule {
                                var block = ((Method) m.parent_symbol).body;
                                instance = new CCodeMemberAccess.pointer (get_variable_cexpression ("_data%d_".printf (get_block_id (block))), "_async_data_");
                        } else {
-                               instance = new CCodeIdentifier ("data");
+                               instance = new CCodeIdentifier ("_data_");
                        }
 
                        in_arg_map.set (get_param_pos (m.cinstance_parameter_position), instance);
@@ -578,7 +578,7 @@ public class Vala.CCodeMethodCallModule : CCodeAssignmentModule {
                        if (expr.is_yield_expression) {
                                // asynchronous call
                                in_arg_map.set (get_param_pos (-1), new CCodeIdentifier (generate_ready_function (current_method)));
-                               in_arg_map.set (get_param_pos (-0.9), new CCodeIdentifier ("data"));
+                               in_arg_map.set (get_param_pos (-0.9), new CCodeIdentifier ("_data_"));
                        }
                }
 
@@ -676,7 +676,7 @@ public class Vala.CCodeMethodCallModule : CCodeAssignmentModule {
                        // set state before calling async function to support immediate callbacks
                        int state = next_coroutine_state++;
 
-                       ccode.add_assignment (new CCodeMemberAccess.pointer (new CCodeIdentifier ("data"), "_state_"), new CCodeConstant (state.to_string ()));
+                       ccode.add_assignment (new CCodeMemberAccess.pointer (new CCodeIdentifier ("_data_"), "_state_"), new CCodeConstant (state.to_string ()));
                        ccode.add_expression (async_call);
                        ccode.add_return (new CCodeConstant ("FALSE"));
                        ccode.add_label ("_state_%d".printf (state));
index ea78b532356df7ebcae2c3a03b7f09a7e8e50964..edda88deced662db8931d0c43ad2b6ef2e969b3d 100644 (file)
@@ -125,12 +125,12 @@ public abstract class Vala.CCodeMethodModule : CCodeStructModule {
        }
 
        public void complete_async () {
-               var state = new CCodeMemberAccess.pointer (new CCodeIdentifier ("data"), "_state_");
+               var state = new CCodeMemberAccess.pointer (new CCodeIdentifier ("_data_"), "_state_");
                var zero = new CCodeConstant ("0");
                var state_is_zero = new CCodeBinaryExpression (CCodeBinaryOperator.EQUALITY, state, zero);
                ccode.open_if (state_is_zero);
 
-               var async_result_expr = new CCodeMemberAccess.pointer (new CCodeIdentifier ("data"), "_async_result");
+               var async_result_expr = new CCodeMemberAccess.pointer (new CCodeIdentifier ("_data_"), "_async_result");
 
                var idle_call = new CCodeFunctionCall (new CCodeIdentifier ("g_simple_async_result_complete_in_idle"));
                idle_call.add_argument (async_result_expr);
@@ -331,7 +331,7 @@ public abstract class Vala.CCodeMethodModule : CCodeStructModule {
                                        function = new CCodeFunction (m.get_real_cname () + "_co", "gboolean");
 
                                        // data struct to hold parameters, local variables, and the return value
-                                       function.add_parameter (new CCodeParameter ("data", Symbol.lower_case_to_camel_case (m.get_cname ()) + "Data*"));
+                                       function.add_parameter (new CCodeParameter ("_data_", Symbol.lower_case_to_camel_case (m.get_cname ()) + "Data*"));
 
                                        function.modifiers |= CCodeModifiers.STATIC;
                                        cfile.add_function_declaration (function);
@@ -350,7 +350,7 @@ public abstract class Vala.CCodeMethodModule : CCodeStructModule {
                if (!m.is_abstract || (m.is_abstract && current_type_symbol is Class)) {
                        if (m.body != null) {
                                if (m.coroutine) {
-                                       ccode.open_switch (new CCodeMemberAccess.pointer (new CCodeIdentifier ("data"), "_state_"));
+                                       ccode.open_switch (new CCodeMemberAccess.pointer (new CCodeIdentifier ("_data_"), "_state_"));
 
                                        // initial coroutine state
                                        ccode.add_case (new CCodeConstant ("0"));
index 80c284eb1a523cf4336b43a4b843cf1be0a1da63..9128fdd9487dfaaf834c75d67db05d95baa403f2 100644 (file)
@@ -97,7 +97,7 @@ public class Vala.GAsyncModule : GSignalModule {
                push_context (new EmitContext (m));
                push_function (freefunc);
 
-               ccode.add_declaration (dataname + "*", new CCodeVariableDeclarator ("data", new CCodeIdentifier ("_data")));
+               ccode.add_declaration (dataname + "*", new CCodeVariableDeclarator ("_data_", new CCodeIdentifier ("_data")));
 
                foreach (Parameter param in m.get_parameters ()) {
                        if (param.direction != ParameterDirection.OUT) {
@@ -136,7 +136,7 @@ public class Vala.GAsyncModule : GSignalModule {
 
                var freecall = new CCodeFunctionCall (new CCodeIdentifier ("g_slice_free"));
                freecall.add_argument (new CCodeIdentifier (dataname));
-               freecall.add_argument (new CCodeIdentifier ("data"));
+               freecall.add_argument (new CCodeIdentifier ("_data_"));
                ccode.add_expression (freecall);
 
                pop_context ();
@@ -488,13 +488,13 @@ public class Vala.GAsyncModule : GSignalModule {
 
                push_function (readyfunc);
 
-               ccode.add_declaration (dataname + "*", new CCodeVariableDeclarator ("data"));
-               ccode.add_assignment (new CCodeIdentifier ("data"), new CCodeIdentifier ("_user_data_"));
-               ccode.add_assignment (new CCodeMemberAccess.pointer (new CCodeIdentifier ("data"), "_source_object_"), new CCodeIdentifier ("source_object"));
-               ccode.add_assignment (new CCodeMemberAccess.pointer (new CCodeIdentifier ("data"), "_res_"), new CCodeIdentifier ("_res_"));
+               ccode.add_declaration (dataname + "*", new CCodeVariableDeclarator ("_data_"));
+               ccode.add_assignment (new CCodeIdentifier ("_data_"), new CCodeIdentifier ("_user_data_"));
+               ccode.add_assignment (new CCodeMemberAccess.pointer (new CCodeIdentifier ("_data_"), "_source_object_"), new CCodeIdentifier ("source_object"));
+               ccode.add_assignment (new CCodeMemberAccess.pointer (new CCodeIdentifier ("_data_"), "_res_"), new CCodeIdentifier ("_res_"));
 
                var ccall = new CCodeFunctionCall (new CCodeIdentifier (m.get_real_cname () + "_co"));
-               ccall.add_argument (new CCodeIdentifier ("data"));
+               ccall.add_argument (new CCodeIdentifier ("_data_"));
                ccode.add_expression (ccall);
 
                readyfunc.modifiers |= CCodeModifiers.STATIC;
@@ -552,7 +552,7 @@ public class Vala.GAsyncModule : GSignalModule {
                if (stmt.yield_expression == null) {
                        int state = next_coroutine_state++;
 
-                       ccode.add_assignment (new CCodeMemberAccess.pointer (new CCodeIdentifier ("data"), "_state_"), new CCodeConstant (state.to_string ()));
+                       ccode.add_assignment (new CCodeMemberAccess.pointer (new CCodeIdentifier ("_data_"), "_state_"), new CCodeConstant (state.to_string ()));
                        ccode.add_return (new CCodeConstant ("FALSE"));
                        ccode.add_label ("_state_%d".printf (state));
                        ccode.add_statement (new CCodeEmptyStatement ());
@@ -590,7 +590,7 @@ public class Vala.GAsyncModule : GSignalModule {
                }
 
                var set_error = new CCodeFunctionCall (new CCodeIdentifier ("g_simple_async_result_set_from_error"));
-               set_error.add_argument (new CCodeMemberAccess.pointer (new CCodeIdentifier ("data"), "_async_result"));
+               set_error.add_argument (new CCodeMemberAccess.pointer (new CCodeIdentifier ("_data_"), "_async_result"));
                set_error.add_argument (error_expr);
                ccode.add_expression (set_error);
 
index c8ee1938a1ae32e32a0248352e73772495848570..4f48750a5894d511f617fa110c0ce5281d30a875 100644 (file)
@@ -319,7 +319,7 @@ public class Vala.GDBusClientModule : GDBusModule {
                        if (expr.is_yield_expression) {
                                // asynchronous call
                                ccall.add_argument (new CCodeIdentifier (generate_ready_function (current_method)));
-                               ccall.add_argument (new CCodeIdentifier ("data"));
+                               ccall.add_argument (new CCodeIdentifier ("_data_"));
                        } else {
                                // begin
                                Expression callback = args.get (base_arg_index + 4);
@@ -356,15 +356,15 @@ public class Vala.GDBusClientModule : GDBusModule {
                        if (expr.is_yield_expression) {
                                int state = next_coroutine_state++;
 
-                               ccode.add_assignment (new CCodeMemberAccess.pointer (new CCodeIdentifier ("data"), "_state_"), new CCodeConstant (state.to_string ()));
+                               ccode.add_assignment (new CCodeMemberAccess.pointer (new CCodeIdentifier ("_data_"), "_state_"), new CCodeConstant (state.to_string ()));
                                ccode.add_expression (ccall);
                                ccode.add_return (new CCodeConstant ("FALSE"));
                                ccode.add_label ("_state_%d".printf (state));
 
                                ccall = new CCodeFunctionCall (new CCodeIdentifier ("g_async_initable_new_finish"));
-                               ccall.add_argument (new CCodeMemberAccess.pointer (new CCodeIdentifier ("data"), "_source_object_"));
+                               ccall.add_argument (new CCodeMemberAccess.pointer (new CCodeIdentifier ("_data_"), "_source_object_"));
                                // pass GAsyncResult stored in closure to finish function
-                               ccall.add_argument (new CCodeMemberAccess.pointer (new CCodeIdentifier ("data"), "_res_"));
+                               ccall.add_argument (new CCodeMemberAccess.pointer (new CCodeIdentifier ("_data_"), "_res_"));
                                ccall.add_argument (new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, get_variable_cexpression ("_inner_error_")));
                        } else {
                                // begin