[vala/wip/gtkgir: 10/12] girparser: Default to "virtual" instead of "abstract" for interface-property



commit 078082cb2150f576c3f51f665c39f6d0e10e73b8
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Fri Dec 8 16:28:57 2017 +0100

    girparser: Default to "virtual" instead of "abstract" for interface-property

 tests/gir/bug742012.test |    2 +-
 vala/valagirparser.vala  |    7 ++++++-
 2 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/tests/gir/bug742012.test b/tests/gir/bug742012.test
index 5ce77a6..531e1ff 100644
--- a/tests/gir/bug742012.test
+++ b/tests/gir/bug742012.test
@@ -91,5 +91,5 @@ public interface Renderer : GLib.Object {
        [CCode (cname = "gcr_renderer_set_attributes")]
        public void set_attributes (GLib.List? attrs);
        [NoAccessorMethod]
-       public abstract GLib.List attributes { owned get; set; }
+       public virtual GLib.List attributes { owned get; set; }
 }
diff --git a/vala/valagirparser.vala b/vala/valagirparser.vala
index 1715ad1..ad7f538 100644
--- a/vala/valagirparser.vala
+++ b/vala/valagirparser.vala
@@ -2971,7 +2971,11 @@ public class Vala.GirParser : CodeVisitor {
        Property parse_property () {
                start_element ("property");
                push_node (element_get_name().replace ("-", "_"), false);
-               bool is_abstract = metadata.get_bool (ArgumentType.ABSTRACT, current.parent.symbol is 
Interface);
+               bool is_abstract = metadata.get_bool (ArgumentType.ABSTRACT);
+               bool is_virtual = false;
+               if (!is_abstract) {
+                       is_virtual = metadata.get_bool (ArgumentType.VIRTUAL, current.parent.symbol is 
Interface);
+               }
                string transfer = reader.get_attribute ("transfer-ownership");
 
                next ();
@@ -2987,6 +2991,7 @@ public class Vala.GirParser : CodeVisitor {
                prop.access = SymbolAccessibility.PUBLIC;
                prop.external = true;
                prop.is_abstract = is_abstract;
+               prop.is_virtual = is_virtual;
                if (no_array_length || array_null_terminated) {
                        prop.set_attribute_bool ("CCode", "array_length", !no_array_length);
                }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]