[vala/switch-to-gir] girparser: Skip class field that refer to the parent instance



commit f86ff0873e2b89c728753c01143c3112d4213bb6
Author: Luca Bruno <lucabru src gnome org>
Date:   Mon Aug 30 13:47:05 2010 +0200

    girparser: Skip class field that refer to the parent instance

 vala/valagirparser.vala |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)
---
diff --git a/vala/valagirparser.vala b/vala/valagirparser.vala
index 4998f5b..beac83c 100644
--- a/vala/valagirparser.vala
+++ b/vala/valagirparser.vala
@@ -1824,6 +1824,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) {
@@ -1840,7 +1841,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") {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]