[vala/0.48] vala: Improve CodeWriter.visit_catch_clause()
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/0.48] vala: Improve CodeWriter.visit_catch_clause()
- Date: Sun, 24 Oct 2021 13:13:01 +0000 (UTC)
commit 13389ff5bfcbcd7b7dfc5eeeec8e9fdaa5c44250
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 82f7efb49..2431afb20 100644
--- a/vala/valacodewriter.vala
+++ b/vala/valacodewriter.vala
@@ -1206,9 +1206,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]