[vala/staging] girparser: Fix parsing of delegate-alias without target
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/staging] girparser: Fix parsing of delegate-alias without target
- Date: Wed, 21 Jun 2017 12:07:10 +0000 (UTC)
commit e9975cdbd681e82484fea72d8fffd110a4b463d7
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 50708d1..a01cd5b 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -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
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 08573b6..2acdf7c 100644
--- a/vala/valagirparser.vala
+++ b/vala/valagirparser.vala
@@ -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 ());
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]