]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
girparser: Fix parsing of delegate-alias without target
authorRico Tzschichholz <ricotz@ubuntu.com>
Wed, 21 Jun 2017 11:29:27 +0000 (13:29 +0200)
committerRico Tzschichholz <ricotz@ubuntu.com>
Wed, 21 Jun 2017 11:54:20 +0000 (13:54 +0200)
"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
tests/gir/delegate-alias-without-target.test [new file with mode: 0644]
vala/valagirparser.vala

index 50708d172a5a0c80de190f9a1ef11fe4677e764b..a01cd5bb192d4aec3f8567f56e310e690e7e4af6 100644 (file)
@@ -291,6 +291,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 (file)
index 0000000..1e2fd36
--- /dev/null
@@ -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 ();
index 08573b67784ca673cede2f48b704697090e8b72a..2acdf7cc796214093d9ff5dbeda3da824c6d574a 100644 (file)
@@ -3639,7 +3639,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 ());