[vala/staging] vala: Improve CodeWriter.visit_catch_clause()
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/staging] vala: Improve CodeWriter.visit_catch_clause()
- Date: Sat, 23 Oct 2021 13:51:19 +0000 (UTC)
commit d1232b99558aa7367605ab49e7a8511d4ea98162
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Sat Oct 23 15:27:12 2021 +0200
vala: Improve CodeWriter.visit_catch_clause()
Properly output general catch clause
vala/valacodewriter.vala | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/vala/valacodewriter.vala b/vala/valacodewriter.vala
index 3e651fd72..cb3bd998d 100644
--- a/vala/valacodewriter.vala
+++ b/vala/valacodewriter.vala
@@ -1217,9 +1217,12 @@ public class Vala.CodeWriter : CodeVisitor {
}
public override void visit_catch_clause (CatchClause clause) {
- var type_name = clause.error_type == null ? "GLib.Error" : clause.error_type.to_string ();
- var var_name = clause.variable_name == null ? "_" : clause.variable_name;
- write_string (" catch (%s %s)".printf (type_name, var_name));
+ if (clause.variable_name != null) {
+ var type_name = clause.error_type == null ? "GLib.Error" :
clause.error_type.to_string ();
+ write_string (" catch (%s %s)".printf (type_name, clause.variable_name));
+ } else {
+ write_string (" catch");
+ }
clause.body.accept (this);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]