--- Palete/Gir.vala +++ Palete/Gir.vala @@ -187,13 +187,26 @@ } public string fqn() { - return this.ns + this.name; + // not sure if fqn really is correct here... + // + return this.nodetype == "Class" || this.nodetype=="Interface" + ? this.name : (this.ns + this.name); } public void copyFrom(GirObject pcls, bool is_interface) { this.inherits.add(pcls.fqn()); + + var liter = pcls.inherits.list_iterator(); + while(liter.next()) { + if (this.inherits.contains(liter.get())) { + continue; + } + this.inherits.add(liter.get()); + } + + var iter = pcls.methods.map_iterator(); while(iter.next()) { if (null != this.methods.get(iter.get_key())) { @@ -241,9 +254,14 @@ } // is_arary / is_instance / is_varargs.. + + + if (this.inherits.size > 0) { + r.set_array_member("inherits", this.toJSONArrayString(this.inherits)); + } if (this.implements.size > 0) { - r.set_array_member("length", this.toJSONArrayString(this.implements)); + r.set_array_member("implements", this.toJSONArrayString(this.implements)); } if (this.params.size > 0) { @@ -315,9 +333,6 @@ return r; } - - - public GirObject fetchByFqn(string fqn) { //print("Searching (%s)%s for %s\n", this.nodetype, this.name, fqn); var bits = fqn.split("."); @@ -462,11 +477,15 @@ // look at includes.. var iter = g.includes.map_iterator(); while(iter.next()) { + // skip empty namespaces on include..? + if ( iter.get_key() == "") { + continue; + } var ret = fqtypeLookup(type, iter.get_key()); if (ret != type) { return ret; } - } + } return type; } @@ -475,7 +494,8 @@ public static string guessDefaultValueForType(string type) { - if (type.contains(".")) { + //print("guessDefaultValueForType: %s\n", type); + if (type.length < 1 || type.contains(".")) { return "null"; } switch(type) { @@ -527,10 +547,11 @@ public void walk(Xml.Node* element, GirObject? parent) { var n = element->get_prop("name"); - if (n == null) { - n = ""; + // ignore null or c:include... + if (n == null || (element->ns->prefix != null && element->ns->prefix == "c")) { + n = ""; } - //print(element->name + " (" + parent.name + "==>" + n +")\n"); + //print("%s:%s (%s ==> %s\n", element->ns->prefix , element->name , parent.name , n); switch (element->name) { case "repository": break; @@ -651,9 +672,12 @@ break; case "instance-parameter": + break; + // looks like this is the C first arg, that is ignored (as it is + // treated as 'this' ) var c = new GirObject("Param",n); - c.gparent = parent; - c.ns = this.ns; + c.gparent = parent; + c.ns = this.ns; c.is_instance = true; parent.params.add(c); parent = c;