]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
GAsync: Push method symbol only when needed when generating async functions
authorLuca Bruno <lucabru@src.gnome.org>
Fri, 1 Jul 2011 14:00:45 +0000 (16:00 +0200)
committerLuca Bruno <lucabru@src.gnome.org>
Wed, 6 Jul 2011 20:32:26 +0000 (22:32 +0200)
Fixes possible regressions of commit 9b22a27ed5ca78b74f56df7 and
commit ab011012db8f5087939514c.

codegen/valagasyncmodule.vala

index c6843ed161204e811d8e402fdd0c80ef70d8fe09..6c4c9ce604aee01022e8639ea367bd906576311d 100644 (file)
@@ -148,7 +148,7 @@ public class Vala.GAsyncModule : GSignalModule {
        }
 
        void generate_async_function (Method m) {
-               push_context (new EmitContext (m));
+               push_context (new EmitContext ());
 
                var dataname = Symbol.lower_case_to_camel_case (m.get_cname ()) + "Data";
                var asyncfunc = new CCodeFunction (m.get_real_cname (), "void");
@@ -246,6 +246,7 @@ public class Vala.GAsyncModule : GSignalModule {
                        ccode.add_assignment (new CCodeMemberAccess.pointer (data_var, "self"), cself);
                }
 
+               emit_context.push_symbol (m);
                foreach (Parameter param in m.get_parameters ()) {
                        if (param.direction != ParameterDirection.OUT) {
                                bool is_unowned_delegate = param.variable_type is DelegateType && !param.variable_type.value_owned;
@@ -268,6 +269,7 @@ public class Vala.GAsyncModule : GSignalModule {
                                param.captured = old_captured;
                        }
                }
+               emit_context.pop_symbol ();
 
                var ccall = new CCodeFunctionCall (new CCodeIdentifier (m.get_real_cname () + "_co"));
                ccall.add_argument (data_var);
@@ -371,7 +373,7 @@ public class Vala.GAsyncModule : GSignalModule {
 
 
        void generate_finish_function (Method m) {
-               push_context (new EmitContext (m));
+               push_context (new EmitContext ());
 
                string dataname = Symbol.lower_case_to_camel_case (m.get_cname ()) + "Data";
 
@@ -416,6 +418,7 @@ public class Vala.GAsyncModule : GSignalModule {
                ccall.add_argument (simple_async_result_cast);
                ccode.add_assignment (data_var, ccall);
 
+               emit_context.push_symbol (m);
                foreach (Parameter param in m.get_parameters ()) {
                        if (param.direction != ParameterDirection.IN) {
                                return_out_parameter (param);
@@ -424,6 +427,7 @@ public class Vala.GAsyncModule : GSignalModule {
                                }
                        }
                }
+               emit_context.pop_symbol ();
 
                if (return_type.is_real_non_null_struct_type ()) {
                        // structs are returned via out parameter