]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
codegen: Make use of CCode.cname for label name of CatchClause
authorRico Tzschichholz <ricotz@ubuntu.com>
Mon, 13 Jul 2020 18:00:08 +0000 (20:00 +0200)
committerRico Tzschichholz <ricotz@ubuntu.com>
Mon, 13 Jul 2020 18:43:56 +0000 (20:43 +0200)
codegen/valagerrormodule.vala
vala/valacatchclause.vala

index 79a96c47ffd8351d047d479ac36099b700cbaa86..fedc424ae71767515df522b6ede8467295260480 100644 (file)
@@ -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 ();
 
index 1ff94211620120701e6c1e06064ce048121a66f3..524d3909f695232463828b4135ea1fe655809f40 100644 (file)
@@ -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;