summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPrinceton Ferro <princetonferro@gmail.com>2020-02-03 03:26:34 -0500
committerRico Tzschichholz <ricotz@ubuntu.com>2020-03-03 10:28:30 +0100
commit7109dd0a0c5823e04659d986a5e00b92bd0dfae8 (patch)
tree1b3b80cea850c3bee20cefdad34ec02eed970866
parent4fb11562ee7bdec234d486d16a154da7b493a8d5 (diff)
downloadvala-7109dd0a0c5823e04659d986a5e00b92bd0dfae8.tar.gz
girparser: Delay adding of "GLib.Object" prerequisite to interfaces
-rw-r--r--vala/valagirparser.vala15
1 files changed, 12 insertions, 3 deletions
diff --git a/vala/valagirparser.vala b/vala/valagirparser.vala
index 1e0d9a939..88f874d8f 100644
--- a/vala/valagirparser.vala
+++ b/vala/valagirparser.vala
@@ -1309,7 +1309,6 @@ public class Vala.GirParser : CodeVisitor {
MarkupReader reader;
CodeContext context;
- Namespace glib_ns;
SourceFile current_source_file;
Node root;
@@ -1331,6 +1330,7 @@ public class Vala.GirParser : CodeVisitor {
HashMap<UnresolvedSymbol,Symbol> unresolved_symbols_map = new HashMap<UnresolvedSymbol,Symbol> (unresolved_symbol_hash, unresolved_symbol_equal);
ArrayList<UnresolvedSymbol> unresolved_gir_symbols = new ArrayList<UnresolvedSymbol> ();
HashMap<UnresolvedType,Node> unresolved_type_arguments = new HashMap<UnresolvedType,Node> ();
+ ArrayList<Interface> ifaces_needing_object_prereq = new ArrayList<Interface> ();
/**
* Parses all .gir source files in the specified code
@@ -1340,7 +1340,6 @@ public class Vala.GirParser : CodeVisitor {
*/
public void parse (CodeContext context) {
this.context = context;
- glib_ns = context.root.scope.lookup ("GLib") as Namespace;
root = new Node (null);
root.symbol = context.root;
@@ -1357,6 +1356,16 @@ public class Vala.GirParser : CodeVisitor {
root.process (this);
+ /* Temporarily workaround G-I bug not adding GLib.Object prerequisite:
+ ensure we have at least one instantiable prerequisite */
+ var glib_ns = context.root.scope.lookup ("GLib") as Namespace;
+ if (glib_ns != null) {
+ var object_type = (Class) glib_ns.scope.lookup ("Object");
+ foreach (var iface in ifaces_needing_object_prereq) {
+ iface.add_prerequisite (new ObjectType (object_type));
+ }
+ }
+
foreach (var metadata in metadata_roots) {
report_unused_metadata (metadata);
}
@@ -3742,7 +3751,7 @@ public class Vala.GirParser : CodeVisitor {
}
if (!has_instantiable_prereq) {
- iface.add_prerequisite (new ObjectType ((ObjectTypeSymbol) glib_ns.scope.lookup ("Object")));
+ ifaces_needing_object_prereq.add (iface);
}
}