[vala] girparser: Ensure interfaces have at least one instantiable prerequisite
- From: Jürg Billeter <juergbi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala] girparser: Ensure interfaces have at least one instantiable prerequisite
- Date: Wed, 21 Jul 2010 15:34:24 +0000 (UTC)
commit 65bc5e64725900961ec7a1bd2d670f8fd20241b1
Author: Philip Withnall <philip withnall collabora co uk>
Date: Wed Jul 21 14:12:20 2010 +0100
girparser: Ensure interfaces have at least one instantiable prerequisite
When parsing a GIR file, add a prerequisite on GLib.Object to interfaces
which don't have an instantiable prerequisite specified in the GIR file,
as g-ir-scanner considers this prerequisite to be implicit.
Fixes bug 624923.
vala/valagirparser.vala | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/vala/valagirparser.vala b/vala/valagirparser.vala
index 1e2ed82..bf1d33e 100644
--- a/vala/valagirparser.vala
+++ b/vala/valagirparser.vala
@@ -801,6 +801,18 @@ public class Vala.GirParser : CodeVisitor {
}
}
+ // ensure we have at least one instantiable prerequisite (GLib.Object)
+ bool has_instantiable_prereq = false;
+ foreach (DataType prereq in iface.get_prerequisites ()) {
+ if (prereq.data_type is Class) {
+ has_instantiable_prereq = true;
+ break;
+ }
+ }
+
+ if (!has_instantiable_prereq)
+ iface.add_prerequisite (new ObjectType ((ObjectTypeSymbol) glib_ns.scope.lookup ("Object")));
+
// virtual method merging
foreach (Method m in vmethods) {
var symbol = iface.scope.lookup (m.name);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]