[vala/0.40] codegen: Don't call get_ccode_finish_instance() with non-async methods
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/0.40] codegen: Don't call get_ccode_finish_instance() with non-async methods
- Date: Mon, 22 Jun 2020 09:06:15 +0000 (UTC)
commit 2c026c019a17ce6c43fa818a880d8957f39c6d3a
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Thu Jun 4 08:10:21 2020 +0200
codegen: Don't call get_ccode_finish_instance() with non-async methods
and restrict evaluation of CCode.finish_* attributes to async methods only
codegen/valaccode.vala | 8 ++++++--
codegen/valaccodebasemodule.vala | 2 +-
codegen/valaccodemethodcallmodule.vala | 4 +++-
3 files changed, 10 insertions(+), 4 deletions(-)
---
diff --git a/codegen/valaccode.vala b/codegen/valaccode.vala
index 7086d6c7a..71b637b59 100644
--- a/codegen/valaccode.vala
+++ b/codegen/valaccode.vala
@@ -177,8 +177,9 @@ namespace Vala {
return get_ccode_free_function (sym) == "g_boxed_free";
}
- public static bool get_ccode_finish_instance (CodeNode node) {
- return get_ccode_attribute (node).finish_instance;
+ public static bool get_ccode_finish_instance (Method m) {
+ assert (m.coroutine);
+ return get_ccode_attribute (m).finish_instance;
}
public static string get_ccode_type_id (CodeNode node) {
@@ -346,14 +347,17 @@ namespace Vala {
}
public static string get_ccode_finish_name (Method m) {
+ assert (m.coroutine);
return get_ccode_attribute(m).finish_name;
}
public static string get_ccode_finish_vfunc_name (Method m) {
+ assert (m.coroutine);
return get_ccode_attribute(m).finish_vfunc_name;
}
public static string get_ccode_finish_real_name (Method m) {
+ assert (m.coroutine);
return get_ccode_attribute(m).finish_real_name;
}
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala
index ab142f01d..a9fd428ba 100644
--- a/codegen/valaccodebasemodule.vala
+++ b/codegen/valaccodebasemodule.vala
@@ -4974,7 +4974,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
}
}
- if (m != null && m.parent_symbol is Class) {
+ if (m != null && m.coroutine && m.parent_symbol is Class) {
if (get_ccode_finish_instance (m)) {
var tmp = new CCodeMemberAccess.pointer (new CCodeIdentifier
("_data_"), "_source_object_");
out_arg_map.set (get_param_pos (get_ccode_instance_pos (m)), tmp);
diff --git a/codegen/valaccodemethodcallmodule.vala b/codegen/valaccodemethodcallmodule.vala
index a36a11119..317091d9c 100644
--- a/codegen/valaccodemethodcallmodule.vala
+++ b/codegen/valaccodemethodcallmodule.vala
@@ -225,7 +225,9 @@ public class Vala.CCodeMethodCallModule : CCodeAssignmentModule {
instance = new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF,
get_cvalue_ (instance_value));
}
- if (expr.is_yield_expression) {
+ if (!m.coroutine) {
+ in_arg_map.set (get_param_pos (get_ccode_instance_pos (m)), instance);
+ } else if (expr.is_yield_expression) {
in_arg_map.set (get_param_pos (get_ccode_instance_pos (m)), instance);
if (get_ccode_finish_instance (m)) {
out_arg_map.set (get_param_pos (get_ccode_instance_pos (m)),
instance);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]