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



commit f74100c2939128ba78363aa4368edea1c44f9c31
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 2968238..bd3c1b6 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -287,6 +287,7 @@ TESTS = \
        gir/bug667751.test \
        gir/bug742012.test \
        gir/array-fixed-length.test \
+       gir/delegate-alias-without-target.test \
        annotations/deprecated.vala \
        annotations/description.vala \
        annotations/noaccessormethod.test \
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 9b4c0e8..43685c9 100644
--- a/vala/valagirparser.vala
+++ b/vala/valagirparser.vala
@@ -3633,7 +3633,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]