]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
girparser: Skip class field that refer to the parent instance
authorLuca Bruno <lucabru@src.gnome.org>
Mon, 30 Aug 2010 11:47:05 +0000 (13:47 +0200)
committerEvan Nemerson <evan@coeus-group.com>
Mon, 8 Nov 2010 09:43:20 +0000 (01:43 -0800)
vala/valagirparser.vala

index 3c346ae361077adac62bb12055a24fc664410e76..b31b01c6af7dc5f57809fb08ba08fbb04e522760 100644 (file)
@@ -1869,6 +1869,7 @@ public class Vala.GirParser : CodeVisitor {
                }
 
                next ();
+               var first_field = true;
                var old_symbols_info = current_symbols_info;
                current_symbols_info = new HashMap<string,ArrayList<SymbolInfo>> (str_hash, str_equal);
                while (current_token == MarkupTokenType.START_ELEMENT) {
@@ -1885,7 +1886,13 @@ public class Vala.GirParser : CodeVisitor {
                        } else if (reader.name == "constant") {
                                add_symbol_info (parse_constant ());
                        } else if (reader.name == "field") {
-                               add_symbol_info (parse_field ());
+                               if (first_field && parent != null) {
+                                       // first field is guaranteed to be the parent instance
+                                       skip_element ();
+                               } else {
+                                       add_symbol_info (parse_field ());
+                               }
+                               first_field = false;
                        } else if (reader.name == "property") {
                                add_symbol_info (parse_property ());
                        } else if (reader.name == "constructor") {