tests/TreeBuilder.vala
[app.Builder.js] / 1.rej
1 --- Palete/Gir.vala
2 +++ Palete/Gir.vala
3 @@ -187,13 +187,26 @@
4                         
5                 }
6                 public string fqn() {
7 -                       return this.ns + this.name;
8 +                       // not sure if fqn really is correct here...
9 +                       // 
10 +                       return this.nodetype == "Class" || this.nodetype=="Interface"
11 +                                       ? this.name : (this.ns + this.name);
12                 }
13                 
14                 public void copyFrom(GirObject pcls, bool is_interface) 
15                 {
16  
17                         this.inherits.add(pcls.fqn());
18 +
19 +                       var liter = pcls.inherits.list_iterator();
20 +                       while(liter.next()) {
21 +                       if (this.inherits.contains(liter.get())) {
22 +                                       continue;
23 +                               }
24 +                               this.inherits.add(liter.get()); 
25 +            }
26 +                       
27 +                       
28                         var iter = pcls.methods.map_iterator();
29                         while(iter.next()) {
30                         if (null != this.methods.get(iter.get_key())) {
31 @@ -241,9 +254,14 @@
32                     }
33                 
34                     // is_arary / is_instance / is_varargs..
35 +
36 +               
37 +                       if (this.inherits.size > 0) {
38 +                       r.set_array_member("inherits", this.toJSONArrayString(this.inherits));
39 +                   }
40                     
41                     if (this.implements.size > 0) {
42 -                       r.set_array_member("length", this.toJSONArrayString(this.implements));
43 +                       r.set_array_member("implements", this.toJSONArrayString(this.implements));
44                     }
45                     
46                     if (this.params.size > 0) {
47 @@ -315,9 +333,6 @@
48                     return r;
49                 }
50  
51 -               
52 -
53 -               
54                 public GirObject fetchByFqn(string fqn) {
55                         //print("Searching (%s)%s for %s\n", this.nodetype, this.name, fqn);
56                         var bits = fqn.split(".");
57 @@ -462,11 +477,15 @@
58                         // look at includes..
59                         var iter = g.includes.map_iterator();
60                         while(iter.next()) {
61 +                               // skip empty namespaces on include..?
62 +                               if ( iter.get_key() == "") {
63 +                                       continue;
64 +                               }
65                                 var ret = fqtypeLookup(type, iter.get_key());
66                                 if (ret != type) {
67                                         return ret;
68                                 }
69 -                       }       
70 +               }       
71                         return type;
72                 }
73                 
74 @@ -475,7 +494,8 @@
75                 
76  
77                 public static string guessDefaultValueForType(string type) {
78 -                       if (type.contains(".")) {
79 +                       //print("guessDefaultValueForType: %s\n", type);
80 +                       if (type.length < 1 || type.contains(".")) {
81                                 return "null";
82                         }
83                         switch(type) {
84 @@ -527,10 +547,11 @@
85                 public void walk(Xml.Node* element, GirObject? parent)
86                 {
87                     var n = element->get_prop("name");
88 -                   if (n == null) {
89 -                       n = "";
90 +                       // ignore null or c:include...
91 +                   if (n == null || (element->ns->prefix != null && element->ns->prefix == "c")) {
92 +                               n = "";
93                     }
94 -                   //print(element->name + " ("  + parent.name + "==>" + n +")\n");
95 +                   //print("%s:%s (%s ==> %s\n", element->ns->prefix , element->name , parent.name , n);
96                     switch (element->name) {
97                         case "repository":
98                             break;
99 @@ -651,9 +672,12 @@
100                             break;
101                         
102                         case "instance-parameter":
103 +                                       break;
104 +                                       // looks  like this is the C first arg, that is ignored (as it is 
105 +                                       // treated as 'this' )
106                                 var c = new GirObject("Param",n);
107 -                               c.gparent = parent;
108 -                               c.ns = this.ns;
109 +                                       c.gparent = parent;
110 +                                       c.ns = this.ns;
111                                 c.is_instance = true;
112                                 parent.params.add(c);
113                                 parent = c;