diff options
Diffstat (limited to 'vala')
-rw-r--r-- | vala/valagirparser.vala | 14 | ||||
-rw-r--r-- | vala/valamethod.vala | 14 |
2 files changed, 28 insertions, 0 deletions
diff --git a/vala/valagirparser.vala b/vala/valagirparser.vala index 061eb17c5..e522d3029 100644 --- a/vala/valagirparser.vala +++ b/vala/valagirparser.vala @@ -4073,6 +4073,20 @@ public class Vala.GirParser : CodeVisitor { void process_async_method (Node node) { var m = (Method) node.symbol; + + // TODO: async methods with out-parameters before in-parameters are not supported + bool requires_pointer = false; + foreach (var param in m.get_parameters ()) { + if (param.direction == ParameterDirection.IN) { + requires_pointer = true; + } else if (requires_pointer) { + param.direction = ParameterDirection.IN; + param.variable_type.nullable = false; + param.variable_type = new PointerType (param.variable_type); + Report.warning (param.source_reference, "Synchronous out-parameters are not supported in async methods"); + } + } + string finish_method_base; if (m.name == null) { assert (m is CreationMethod); diff --git a/vala/valamethod.vala b/vala/valamethod.vala index bd203ab36..22980085f 100644 --- a/vala/valamethod.vala +++ b/vala/valamethod.vala @@ -815,6 +815,20 @@ public class Vala.Method : Subroutine, Callable { } } + if (coroutine) { + // TODO: async methods with out-parameters before in-parameters are not supported + bool requires_pointer = false; + for (int i = parameters.size - 1; i >= 0; i--) { + var param = parameters[i]; + if (param.direction == ParameterDirection.IN) { + requires_pointer = true; + } else if (requires_pointer) { + error = true; + Report.error (param.source_reference, "Synchronous out-parameters are not supported in async methods"); + } + } + } + if (error_types != null) { foreach (DataType error_type in error_types) { error_type.check (context); |