[vala/staging] codegen: Fix default of CCode.pos for parameters in async methods
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/staging] codegen: Fix default of CCode.pos for parameters in async methods
- Date: Sun, 19 Apr 2020 16:38:18 +0000 (UTC)
commit b1cb7036bee1f21e98e93ac34b31a95eeed32815
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Sun Apr 19 18:20:41 2020 +0200
codegen: Fix default of CCode.pos for parameters in async methods
codegen/valaccodeattribute.vala | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
---
diff --git a/codegen/valaccodeattribute.vala b/codegen/valaccodeattribute.vala
index f8491e015..935810d2a 100644
--- a/codegen/valaccodeattribute.vala
+++ b/codegen/valaccodeattribute.vala
@@ -422,7 +422,17 @@ public class Vala.CCodeAttribute : AttributeCache {
} else {
unowned Parameter param = (Parameter) node;
unowned Callable? callable = param.parent_symbol as Callable;
- if (callable != null) {
+ unowned Method? method = param.parent_symbol as Method;
+ if (method != null && method.coroutine) {
+ int index = method.get_async_begin_parameters ().index_of
(param);
+ if (index < 0) {
+ index = method.get_async_end_parameters ().index_of
(param);
+ }
+ if (index < 0) {
+ Report.error (param.source_reference, "internal:
Parameter `%s' not found in `%s'".printf (param.name, method.get_full_name ()));
+ }
+ _pos = index + 1.0;
+ } else if (callable != null) {
_pos = callable.get_parameters ().index_of (param) + 1.0;
} else {
_pos = 0.0;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]