[vala/0.34] girparser: Fix parsing of delegate-alias without target



commit f65796f68247e4d235ea121d75f9ed0b4c0272c9
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Wed Jun 21 13:29:27 2017 +0200

    girparser: Fix parsing of delegate-alias without target
    
    "has_target" is a ccode-attribute-based property, so don't explicitly set
    it and rely on attribute-list-copy. Otherwise there will a fatal duplicated
    CCode attribute.

 tests/Makefile.am                            |    1 +
 tests/gir/delegate-alias-without-target.test |   20 ++++++++++++++++++++
 vala/valagirparser.vala                      |    1 -
 3 files changed, 21 insertions(+), 1 deletions(-)
---
diff --git a/tests/Makefile.am b/tests/Makefile.am
index f211809..4cf5dd7 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -237,6 +237,7 @@ TESTS = \
        gir/bug651773.test \
        gir/bug667751.test \
        gir/bug742012.test \
+       gir/delegate-alias-without-target.test \
        $(NULL)
 
 NON_NULL_TESTS = \
diff --git a/tests/gir/delegate-alias-without-target.test b/tests/gir/delegate-alias-without-target.test
new file mode 100644
index 0000000..1e2fd36
--- /dev/null
+++ b/tests/gir/delegate-alias-without-target.test
@@ -0,0 +1,20 @@
+GIR
+
+Input:
+
+<alias name="Foo" c:type="TestFoo">
+  <type name="Bar" c:type="TestBar"/>
+</alias>
+
+<callback name="Bar" c:type="TestBar">
+  <return-value transfer-ownership="none">
+    <type name="none" c:type="void"/>
+  </return-value>
+</callback>
+
+Output:
+
+[CCode (cheader_filename = "test.h", has_target = false)]
+public delegate void Bar ();
+[CCode (cheader_filename = "test.h", has_target = false)]
+public delegate void Foo ();
diff --git a/vala/valagirparser.vala b/vala/valagirparser.vala
index bc7a094..9e33a4f 100644
--- a/vala/valagirparser.vala
+++ b/vala/valagirparser.vala
@@ -3584,7 +3584,6 @@ public class Vala.GirParser : CodeVisitor {
                        
                        var deleg = new Delegate (alias.name, orig.return_type.copy (), 
alias.source_reference);
                        deleg.access = orig.access;
-                       deleg.has_target = orig.has_target;
                        
                        foreach (var param in orig.get_parameters ()) {
                                deleg.add_parameter (param.copy ());


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