From: Rico Tzschichholz Date: Tue, 19 Jan 2021 20:56:50 +0000 (+0100) Subject: vala: Make Class.is_compat/is_immutable/is_singleton read-only X-Git-Tag: 0.51.1~87 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a7d6533eda8fda65d8b24c3622b0e63fb90780b2;p=thirdparty%2Fvala.git vala: Make Class.is_compat/is_immutable/is_singleton read-only --- diff --git a/vala/valaclass.vala b/vala/valaclass.vala index da1f81a33..3bf845847 100644 --- a/vala/valaclass.vala +++ b/vala/valaclass.vala @@ -59,10 +59,6 @@ public class Vala.Class : ObjectTypeSymbol { } return _is_compact; } - set { - _is_compact = value; - set_attribute ("Compact", value); - } } /** @@ -92,10 +88,6 @@ public class Vala.Class : ObjectTypeSymbol { } return _is_immutable; } - set { - _is_immutable = value; - set_attribute ("Immutable", value); - } } /** @@ -108,10 +100,6 @@ public class Vala.Class : ObjectTypeSymbol { } return _is_singleton; } - set { - _is_singleton = value; - set_attribute ("SingleInstance", value); - } } /** diff --git a/vala/valagirparser.vala b/vala/valagirparser.vala index c077411cc..ee520350d 100644 --- a/vala/valagirparser.vala +++ b/vala/valagirparser.vala @@ -3484,7 +3484,7 @@ public class Vala.GirParser : CodeVisitor { bool require_copy_free = false; if (current.new_symbol) { cl = new Class (current.name, current.source_reference); - cl.is_compact = true; + cl.set_attribute ("Compact", true); current.symbol = cl; } else { cl = (Class) current.symbol; @@ -3812,7 +3812,7 @@ public class Vala.GirParser : CodeVisitor { cl.add_base_type (base_type); } cl.comment = alias.comment; - cl.is_compact = ((Class) type_sym).is_compact; + cl.set_attribute ("Compact", ((Class) type_sym).is_compact); alias.symbol = cl; } else if (type_sym is Interface) { // this is not a correct alias, but what can we do otherwise? diff --git a/vapigen/valagidlparser.vala b/vapigen/valagidlparser.vala index 3ffa0c53b..007896ec4 100644 --- a/vapigen/valagidlparser.vala +++ b/vapigen/valagidlparser.vala @@ -898,7 +898,7 @@ public class Vala.GIdlParser : CodeVisitor { } } else if (nv[0] == "is_immutable") { if (eval (nv[1]) == "1") { - cl.is_immutable = true; + cl.set_attribute ("Immutable", true); } } else if (nv[0] == "const_cname") { cl.set_attribute_string ("CCode", "const_cname", eval (nv[1])); @@ -952,7 +952,7 @@ public class Vala.GIdlParser : CodeVisitor { cl.add_base_type (parent); } if (base_class == null && !is_fundamental) { - cl.is_compact = true; + cl.set_attribute ("Compact", true); } } @@ -1069,7 +1069,7 @@ public class Vala.GIdlParser : CodeVisitor { if (cl == null) { cl = new Class (name, current_source_reference); cl.access = SymbolAccessibility.PUBLIC; - cl.is_compact = true; + cl.set_attribute ("Compact", true); var cl_attributes = get_attributes (node.name); if (cl_attributes != null) { @@ -1230,7 +1230,7 @@ public class Vala.GIdlParser : CodeVisitor { cl = new Class (name, current_source_reference); cl.access = SymbolAccessibility.PUBLIC; - cl.is_compact = true; + cl.set_attribute ("Compact", true); if (boxed_node.gtype_init != null) { cl.set_attribute_string ("CCode", "type_id", "%s ()".printf (boxed_node.gtype_init)); } @@ -1245,7 +1245,7 @@ public class Vala.GIdlParser : CodeVisitor { base_class = eval (nv[1]); } else if (nv[0] == "is_immutable") { if (eval (nv[1]) == "1") { - cl.is_immutable = true; + cl.set_attribute ("Immutable", true); } } else if (nv[0] == "deprecated") { if (eval (nv[1]) == "1") { @@ -1540,7 +1540,7 @@ public class Vala.GIdlParser : CodeVisitor { } } else if (nv[0] == "compact") { if (eval (nv[1]) == "1") { - cl.is_compact = true; + cl.set_attribute ("Compact", true); } } else if (nv[0] == "ref_function") { cl.set_attribute_string ("CCode", "ref_function", eval (nv[1]));