[vala/staging] codegen: Make use of CCode.cname for label name of CatchClause
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/staging] codegen: Make use of CCode.cname for label name of CatchClause
- Date: Tue, 14 Jul 2020 12:14:52 +0000 (UTC)
commit 9f1d443b9bfa54232ffa6d7131f4b0c498e82031
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Mon Jul 13 20:00:08 2020 +0200
codegen: Make use of CCode.cname for label name of CatchClause
codegen/valagerrormodule.vala | 8 ++++----
vala/valacatchclause.vala | 5 -----
2 files changed, 4 insertions(+), 9 deletions(-)
---
diff --git a/codegen/valagerrormodule.vala b/codegen/valagerrormodule.vala
index 79a96c47f..fedc424ae 100644
--- a/codegen/valagerrormodule.vala
+++ b/codegen/valagerrormodule.vala
@@ -218,7 +218,7 @@ public class Vala.GErrorModule : CCodeDelegateModule {
if (clause.error_type.equals (gerror_type)) {
// general catch clause, this should be the last one
has_general_catch_clause = true;
- ccode.add_goto (clause.clabel_name);
+ ccode.add_goto (clause.get_attribute_string ("CCode",
"cname"));
break;
} else {
var catch_type = clause.error_type as ErrorType;
@@ -241,7 +241,7 @@ public class Vala.GErrorModule : CCodeDelegateModule {
}
// go to catch clause if error domain matches
- ccode.add_goto (clause.clabel_name);
+ ccode.add_goto (clause.get_attribute_string ("CCode",
"cname"));
ccode.close ();
}
}
@@ -316,7 +316,7 @@ public class Vala.GErrorModule : CCodeDelegateModule {
is_in_catch = true;
foreach (CatchClause clause in stmt.get_catch_clauses ()) {
- clause.clabel_name = "__catch%d_%s".printf (this_try_id, get_ccode_lower_case_name
(clause.error_type));
+ clause.set_attribute_string ("CCode", "cname", "__catch%d_%s".printf (this_try_id,
get_ccode_lower_case_name (clause.error_type)));
}
is_in_catch = false;
@@ -356,7 +356,7 @@ public class Vala.GErrorModule : CCodeDelegateModule {
generate_error_domain_declaration (error_type.error_domain, cfile);
}
- ccode.add_label (clause.clabel_name);
+ ccode.add_label (clause.get_attribute_string ("CCode", "cname"));
ccode.open_block ();
diff --git a/vala/valacatchclause.vala b/vala/valacatchclause.vala
index 1ff942116..524d3909f 100644
--- a/vala/valacatchclause.vala
+++ b/vala/valacatchclause.vala
@@ -65,11 +65,6 @@ public class Vala.CatchClause : CodeNode {
}
}
- /**
- * Specifies the label used for this catch clause in the C code.
- */
- public string? clabel_name { get; set; }
-
private DataType _data_type;
private Block _body;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]