[vala/staging] girparser: Detect special delegate error parameter in process_callable()
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/staging] girparser: Detect special delegate error parameter in process_callable()
- Date: Sat, 18 Apr 2020 11:12:23 +0000 (UTC)
commit 98675b545590d1b28dbcab9f7fd350f69037bc13
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Fri Apr 17 23:07:55 2020 +0200
girparser: Detect special delegate error parameter in process_callable()
vala/valagirparser.vala | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
---
diff --git a/vala/valagirparser.vala b/vala/valagirparser.vala
index 07e70aa34..338775dc5 100644
--- a/vala/valagirparser.vala
+++ b/vala/valagirparser.vala
@@ -3280,7 +3280,6 @@ public class Vala.GirParser : CodeVisitor {
((Delegate) s).add_error_type (error_type);
}
}
- throws_string = "1";
} else if (throws_string == "1") {
if (s is Method) {
((Method) s).add_error_type (new ErrorType (null, null));
@@ -3415,9 +3414,9 @@ public class Vala.GirParser : CodeVisitor {
}
var info = new ParameterInfo (param, array_length_idx, closure_idx,
destroy_idx, scope == "async");
- unowned UnresolvedType? unresolved_type = param.variable_type as
UnresolvedType;
if (s is Method && scope == "async") {
+ unowned UnresolvedType? unresolved_type = param.variable_type as
UnresolvedType;
if (unresolved_type != null && unresolved_type.unresolved_symbol.name
== "AsyncReadyCallback") {
// GAsync-style method
((Method) s).coroutine = true;
@@ -3425,14 +3424,6 @@ public class Vala.GirParser : CodeVisitor {
}
}
- if (s is Delegate && throws_string != "1" && param.direction ==
ParameterDirection.OUT) {
- if (unresolved_type != null &&
unresolved_type.unresolved_symbol.to_string () == "GLib.Error") {
- ((Delegate) s).add_error_type (new ErrorType (null, null));
- info.is_error = true;
- info.keep = false;
- }
- }
-
parameters.add (info);
pop_metadata ();
}
@@ -3942,6 +3933,15 @@ public class Vala.GirParser : CodeVisitor {
type.nullable = false;
}
}
+
+ if (s is Delegate && !s.tree_can_fail && info.param.direction ==
ParameterDirection.OUT) {
+ unowned UnresolvedType? unresolved_type = type as UnresolvedType;
+ if (unresolved_type != null && unresolved_type.unresolved_symbol.to_string ()
== "GLib.Error") {
+ ((Delegate) s).add_error_type (new ErrorType (null, null));
+ info.is_error = true;
+ info.keep = false;
+ }
+ }
}
if (parameters.size > 1) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]