diff options
author | Jürg Billeter <j@bitron.ch> | 2011-01-20 11:14:35 +0100 |
---|---|---|
committer | Jürg Billeter <j@bitron.ch> | 2011-01-20 11:19:58 +0100 |
commit | 322e73fe74955e171953aa51059dfdf6c01d18a5 (patch) | |
tree | e62ee18cf266ea9c6af12b00c45ed459508f06be /codegen/valaccodememberaccessmodule.vala | |
parent | 4ba52a117418889bcb5d82a51a8defdee48fe551 (diff) | |
download | vala-322e73fe74955e171953aa51059dfdf6c01d18a5.tar.gz |
codegen: Revert not_in_coroutine convenience parameter
Commit fb0c4bb7 broke closures in async methods.
Diffstat (limited to 'codegen/valaccodememberaccessmodule.vala')
-rw-r--r-- | codegen/valaccodememberaccessmodule.vala | 41 |
1 files changed, 12 insertions, 29 deletions
diff --git a/codegen/valaccodememberaccessmodule.vala b/codegen/valaccodememberaccessmodule.vala index 391f1c30f..882109dce 100644 --- a/codegen/valaccodememberaccessmodule.vala +++ b/codegen/valaccodememberaccessmodule.vala @@ -521,13 +521,8 @@ public abstract class Vala.CCodeMemberAccessModule : CCodeControlFlowModule { } } - /** - * Returns lvalue access to the given local variable. - * - * @param not_in_coroutine enforces not to be in a coroutine - * @return the computed C lvalue - */ - public TargetValue get_local_cvalue (LocalVariable local, bool not_in_coroutine = false) { + /* Returns lvalue access to the given local variable */ + public TargetValue get_local_cvalue (LocalVariable local) { var result = new GLibValue (local.variable_type.copy ()); var array_type = local.variable_type as ArrayType; @@ -565,7 +560,7 @@ public abstract class Vala.CCodeMemberAccessModule : CCodeControlFlowModule { result.array_size_cvalue = get_variable_cexpression (get_array_size_cname (get_variable_cname (local.name))); } } else if (delegate_type != null && delegate_type.delegate_symbol.has_target) { - if (is_in_coroutine () && !not_in_coroutine) { + 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_destroy_notify_cvalue = new CCodeMemberAccess.pointer (new CCodeIdentifier ("data"), get_delegate_target_destroy_notify_cname (get_variable_cname (local.name))); } else { @@ -580,15 +575,10 @@ public abstract class Vala.CCodeMemberAccessModule : CCodeControlFlowModule { return result; } - /** - * Returns lvalue access to the given local variable. - * - * @param not_in_coroutine enforces not to be in a coroutine - * @return the computed C lvalue - */ - public TargetValue get_parameter_cvalue (Parameter param, bool not_in_coroutine = false) { + /* Returns access values to the given parameter */ + public TargetValue get_parameter_cvalue (Parameter param) { var result = new GLibValue (param.variable_type.copy ()); - if (param.captured || (is_in_coroutine () && !not_in_coroutine)) { + if (param.captured || is_in_coroutine ()) { result.value_type.value_owned = true; } @@ -596,7 +586,7 @@ public abstract class Vala.CCodeMemberAccessModule : CCodeControlFlowModule { var delegate_type = result.value_type as DelegateType; if (param.name == "this") { - if (is_in_coroutine () && !not_in_coroutine) { + if (is_in_coroutine ()) { // use closure result.cvalue = new CCodeMemberAccess.pointer (new CCodeIdentifier ("data"), "self"); } else { @@ -625,7 +615,7 @@ public abstract class Vala.CCodeMemberAccessModule : CCodeControlFlowModule { result.delegate_target_cvalue = new CCodeMemberAccess.pointer (get_variable_cexpression ("_data%d_".printf (get_block_id (block))), get_delegate_target_cname (get_variable_cname (param.name))); result.delegate_target_destroy_notify_cvalue = new CCodeMemberAccess.pointer (get_variable_cexpression ("_data%d_".printf (get_block_id (block))), get_delegate_target_destroy_notify_cname (get_variable_cname (param.name))); } - } else if (is_in_coroutine () && !not_in_coroutine) { + } else if (is_in_coroutine ()) { // use closure result.cvalue = get_variable_cexpression (param.name); if (delegate_type != null && delegate_type.delegate_symbol.has_target) { @@ -693,18 +683,12 @@ public abstract class Vala.CCodeMemberAccessModule : CCodeControlFlowModule { return value; } - /** - * Returns lvalue access to the given symbol. - * - * @param not_in_coroutine enforces not to be in a coroutine for local variables and parameters - * @param inner instance expression for accessing fields or properties - * @return the computed C lvalue - */ - public override TargetValue get_variable_cvalue (Variable variable, CCodeExpression? inner = null, bool not_in_coroutine = false) { + /* Returns lvalue access to the given symbol */ + public override TargetValue get_variable_cvalue (Variable variable, CCodeExpression? inner = null) { if (variable is LocalVariable) { - return get_local_cvalue ((LocalVariable) variable, not_in_coroutine); + return get_local_cvalue ((LocalVariable) variable); } else if (variable is Parameter) { - return get_parameter_cvalue ((Parameter) variable, not_in_coroutine); + return get_parameter_cvalue ((Parameter) variable); } else { assert_not_reached (); } @@ -720,7 +704,6 @@ public abstract class Vala.CCodeMemberAccessModule : CCodeControlFlowModule { return load_variable (local, result); } - /* Returns unowned access to the given parameter */ public TargetValue load_parameter (Parameter param) { var result = (GLibValue) get_parameter_cvalue (param); if (result.value_type is DelegateType) { |