[vala/0.54] vala: Improve CodeWriter.visit_catch_clause()
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/0.54] vala: Improve CodeWriter.visit_catch_clause()
- Date: Sun, 24 Oct 2021 13:13:13 +0000 (UTC)
commit e255b5dcd82d1d393550144d292538aabd8d72f9
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]