]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
girparser: Improve handling of deprecated=false metadata
authorRico Tzschichholz <ricotz@ubuntu.com>
Mon, 24 Apr 2023 08:00:44 +0000 (10:00 +0200)
committerRico Tzschichholz <ricotz@ubuntu.com>
Thu, 7 Aug 2025 10:12:47 +0000 (12:12 +0200)
vala/valagirparser.vala

index c51261e197e7491f17a558bc3bcb6b20b2bdf0c6..ab4be1ae2a3746ea99e9fb4c55f294cb753fba4a 100644 (file)
@@ -556,7 +556,7 @@ public class Vala.GirParser : CodeVisitor {
                // objecttypesymbol-specific
                public List<DataType> inherited_types;
 
-               public bool deprecated = false;
+               public bool? deprecated = null;
                public uint64 deprecated_version = 0;
                public string? deprecated_since = null;
                public string? deprecated_replacement = null;
@@ -1264,7 +1264,7 @@ public class Vala.GirParser : CodeVisitor {
                                }
                                if (metadata.has_argument (ArgumentType.DEPRECATED)) {
                                        deprecated = metadata.get_bool (ArgumentType.DEPRECATED, true);
-                                       if (!deprecated) {
+                                       if (deprecated == false) {
                                                deprecated_since = null;
                                                deprecated_replacement = null;
                                        }
@@ -1322,13 +1322,13 @@ public class Vala.GirParser : CodeVisitor {
                                foreach (var node in members) {
                                        if (this.deprecated_version > 0 && node.deprecated_version > 0) {
                                                if (this.deprecated_version <= node.deprecated_version) {
-                                                       node.deprecated = false;
+                                                       node.deprecated = null;
                                                        node.deprecated_since = null;
                                                        node.deprecated_replacement = null;
                                                }
                                        }
-                                       if (node.deprecated) {
-                                               node.symbol.version.deprecated = true;
+                                       if (node.deprecated != null) {
+                                               node.symbol.version.deprecated = node.deprecated;
                                        }
                                        if (node.deprecated_since != null) {
                                                node.symbol.version.deprecated_since = node.deprecated_since;