vala r1049 - in trunk: . vala vapi vapi/packages/gtk+-2.0 vapigen



Author: juergbi
Date: Sun Feb 24 15:15:07 2008
New Revision: 1049
URL: http://svn.gnome.org/viewvc/vala?rev=1049&view=rev

Log:
2008-02-24  Juerg Billeter  <j bitron ch>

	* vala/parser.y, vala/vala.h, vala/valasymbolresolver.vala,
	  vala/valaunresolvedsymbol.vala, vala/valaunresolvedtype.vala:
	  generalize symbol resolving to fully support inner types

	* vala/Makefile.am: update

	* vapigen/valagidlparser.vala, vapi/packages/gtk+-2.0/: adapt to
	  new symbol resolving

	* vapi/atk.vapi, vapi/gdk-2.0.vapi, vapi/glib-2.0.vapi,
	  vapi/gnome-desktop-2.0.vapi, vapi/gnome-vfs-2.0.vapi,
	  vapi/gstreamer-0.10.vapi, vapi/gtk+-2.0.vapi,
	  vapi/libglade-2.0.vapi, vapi/libgnomeui-2.0.vapi,
	  vapi/webkit-1.0.vapi: regenerated


Added:
   trunk/vala/valaunresolvedsymbol.vala
Modified:
   trunk/ChangeLog
   trunk/vala/Makefile.am
   trunk/vala/parser.y
   trunk/vala/vala.h
   trunk/vala/valasymbolresolver.vala
   trunk/vala/valaunresolvedtype.vala
   trunk/vapi/atk.vapi
   trunk/vapi/gdk-2.0.vapi
   trunk/vapi/glib-2.0.vapi
   trunk/vapi/gnome-desktop-2.0.vapi
   trunk/vapi/gnome-vfs-2.0.vapi
   trunk/vapi/gstreamer-0.10.vapi
   trunk/vapi/gtk+-2.0.vapi
   trunk/vapi/libglade-2.0.vapi
   trunk/vapi/libgnomeui-2.0.vapi
   trunk/vapi/packages/gtk+-2.0/gtk+-2.0.metadata
   trunk/vapi/webkit-1.0.vapi
   trunk/vapigen/valagidlparser.vala

Modified: trunk/vala/Makefile.am
==============================================================================
--- trunk/vala/Makefile.am	(original)
+++ trunk/vala/Makefile.am	Sun Feb 24 15:15:07 2008
@@ -131,6 +131,7 @@
 	valatypeparameter.vala \
 	valatypesymbol.vala \
 	valaunaryexpression.vala \
+	valaunresolvedsymbol.vala \
 	valaunresolvedtype.vala \
 	valavaluetype.vala \
 	valavariabledeclarator.vala \

Modified: trunk/vala/parser.y
==============================================================================
--- trunk/vala/parser.y	(original)
+++ trunk/vala/parser.y	Sun Feb 24 15:15:07 2008
@@ -72,6 +72,7 @@
 	char *str;
 	GList *list;
 	ValaLiteral *literal;
+	ValaUnresolvedSymbol *unresolved_symbol;
 	ValaDataType *type_reference;
 	ValaExpression *expression;
 	ValaStatement *statement;
@@ -228,6 +229,7 @@
 %type <literal> literal
 %type <literal> boolean_literal
 %type <num> stars
+%type <unresolved_symbol> symbol_name
 %type <type_reference> type_name
 %type <type_reference> type
 %type <list> opt_argument_list
@@ -538,33 +540,36 @@
 	: opt_using_directives opt_outer_declarations
 	;
 
-type_name
-	: identifier opt_type_argument_list
+symbol_name
+	: identifier
 	  {
-	  	GList *l;
-		ValaSourceReference *src = src(@1);
-		$$ = VALA_DATA_TYPE (vala_unresolved_type_new_from_name (NULL, $1, src));
+	  	ValaSourceReference *src = src(@1);
+		$$ = vala_unresolved_symbol_new (NULL, $1, src);
 		g_free ($1);
 		g_object_unref (src);
-		for (l = $2; l != NULL; l = l->next) {
-			vala_data_type_add_type_argument (VALA_DATA_TYPE ($$), l->data);
-			g_object_unref (l->data);
-		}
-		g_list_free ($2);
 	  }
-	| identifier DOT identifier opt_type_argument_list
+	| symbol_name DOT identifier
 	  {
-	  	GList *l;
-		ValaSourceReference *src = src(@1);
-		$$ = VALA_DATA_TYPE (vala_unresolved_type_new_from_name ($1, $3, src));
-		g_free ($1);
+	  	ValaSourceReference *src = src(@1);
+		$$ = vala_unresolved_symbol_new ($1, $3, src);
 		g_free ($3);
 		g_object_unref (src);
-		for (l = $4; l != NULL; l = l->next) {
+	  }
+	;
+
+type_name
+	: symbol_name opt_type_argument_list
+	  {
+	  	GList *l;
+	  	ValaSourceReference *src = src(@1);
+		$$ = VALA_DATA_TYPE (vala_unresolved_type_new_from_symbol ($1, src));
+		g_object_unref ($1);
+		g_object_unref (src);
+		for (l = $2; l != NULL; l = l->next) {
 			vala_data_type_add_type_argument (VALA_DATA_TYPE ($$), l->data);
 			g_object_unref (l->data);
 		}
-		g_list_free ($4);
+		g_list_free ($2);
 	  }
 	;
 
@@ -3135,7 +3140,7 @@
 method_header
 	: comment opt_attributes opt_access_modifier opt_modifiers type identifier OPEN_PARENS opt_formal_parameter_list CLOSE_PARENS opt_throws_declaration opt_requires_declarations opt_ensures_declarations
 	  {
-	  	GList *l;
+		GList *l;
 		ValaSourceReference *src;
 		ValaModifier vmodifiers;
 
@@ -3215,14 +3220,16 @@
 			$$ = NULL;
 		}
 	  }
-	| comment opt_attributes opt_access_modifier opt_modifiers identifier opt_name_specifier OPEN_PARENS opt_formal_parameter_list CLOSE_PARENS opt_throws_declaration
+	| comment opt_attributes opt_access_modifier opt_modifiers symbol_name OPEN_PARENS opt_formal_parameter_list CLOSE_PARENS opt_throws_declaration
 	  {
 		GList *l;
-	  	
+		
 		ValaSourceReference *src = src_com(@5, $1);
-		$$ = VALA_METHOD (vala_code_context_create_creation_method (context, $5, $6, src));
-		g_free ($5);
-		g_free ($6);
+		if (vala_unresolved_symbol_get_inner ($5) == NULL) {
+			$$ = VALA_METHOD (vala_code_context_create_creation_method (context, vala_unresolved_symbol_get_name ($5), NULL, src)); } else {
+			$$ = VALA_METHOD (vala_code_context_create_creation_method (context, vala_unresolved_symbol_get_name (vala_unresolved_symbol_get_inner ($5)), vala_unresolved_symbol_get_name ($5), src));
+		}
+		g_object_unref ($5);
 		g_object_unref (src);
 		vala_method_set_instance ($$, FALSE);
 		if ($3 != -1) {
@@ -3230,20 +3237,20 @@
 		}
 		VALA_CODE_NODE($$)->attributes = $2;
 		
-		if ($8 != NULL) {
-			for (l = $8; l != NULL; l = l->next) {
+		if ($7 != NULL) {
+			for (l = $7; l != NULL; l = l->next) {
 				vala_method_add_parameter ($$, l->data);
 				g_object_unref (l->data);
 			}
-			g_list_free ($8);
+			g_list_free ($7);
 		}
 
-		for (l = $10; l != NULL; l = l->next) {
+		for (l = $9; l != NULL; l = l->next) {
 			vala_method_add_error_domain ($$, l->data);
 			g_object_unref (l->data);
 		}
-		if ($10 != NULL) {
-			g_list_free ($10);
+		if ($9 != NULL) {
+			g_list_free ($9);
 		}
 	  }
 	;

Modified: trunk/vala/vala.h
==============================================================================
--- trunk/vala/vala.h	(original)
+++ trunk/vala/vala.h	Sun Feb 24 15:15:07 2008
@@ -80,6 +80,7 @@
 #include <vala/valatypeparameter.h>
 #include <vala/valatypesymbol.h>
 #include <vala/valaunaryexpression.h>
+#include <vala/valaunresolvedsymbol.h>
 #include <vala/valaunresolvedtype.h>
 #include <vala/valavariabledeclarator.h>
 #include <vala/valavoidtype.h>

Modified: trunk/vala/valasymbolresolver.vala
==============================================================================
--- trunk/vala/valasymbolresolver.vala	(original)
+++ trunk/vala/valasymbolresolver.vala	Sun Feb 24 15:15:07 2008
@@ -180,34 +180,13 @@
 		}
 	}
 
-	private DataType! resolve_type (UnresolvedType! unresolved_type) {
-		var type = new DataType ();
-		type.source_reference = unresolved_type.source_reference;
-		type.takes_ownership = unresolved_type.takes_ownership;
-		type.transfers_ownership = unresolved_type.transfers_ownership;
-		type.is_ref = unresolved_type.is_ref;
-		type.is_out = unresolved_type.is_out;
-		type.nullable = unresolved_type.nullable;
-		type.requires_null_check = unresolved_type.requires_null_check;
-		foreach (DataType type_arg in unresolved_type.get_type_arguments ()) {
-			type.add_type_argument (type_arg);
-		}
-
-		// still required for vapigen
-		if (unresolved_type.type_name == "void") {
-			return new VoidType ();
-		}
-
-		if (unresolved_type.namespace_name == null) {
+	private Symbol? resolve_symbol (UnresolvedSymbol unresolved_symbol) {
+		if (unresolved_symbol.inner == null) {
 			Symbol sym = null;
 			Scope scope = current_scope;
 			while (sym == null && scope != null) {
-				sym = scope.lookup (unresolved_type.type_name);
+				sym = scope.lookup (unresolved_symbol.name);
 				scope = scope.parent_scope;
-				if (sym != null && !(sym is Typesymbol) && !(sym is TypeParameter)) {
-					// ignore non-type symbols
-					sym = null;
-				}
 			}
 			if (sym == null) {
 				foreach (NamespaceReference ns in current_using_directives) {
@@ -215,55 +194,68 @@
 						continue;
 					}
 
-					var local_sym = ns.namespace_symbol.scope.lookup (unresolved_type.type_name);
+					var local_sym = ns.namespace_symbol.scope.lookup (unresolved_symbol.name);
 					if (local_sym != null) {
 						if (sym != null) {
-							Report.error (type.source_reference, "`%s' is an ambiguous reference between `%s' and `%s'".printf (unresolved_type.type_name, sym.get_full_name (), local_sym.get_full_name ()));
-							return new InvalidType ();
+							unresolved_symbol.error = true;
+							Report.error (unresolved_symbol.source_reference, "`%s' is an ambiguous reference between `%s' and `%s'".printf (unresolved_symbol.name, sym.get_full_name (), local_sym.get_full_name ()));
+							return null;
 						}
 						sym = local_sym;
 					}
 				}
 			}
-			if (sym == null) {
-				Report.error (type.source_reference, "The type name `%s' could not be found".printf (unresolved_type.type_name));
-				return new InvalidType ();
-			}
-			if (sym is TypeParameter) {
-				type.type_parameter = (TypeParameter) sym;
-			} else if (sym is Typesymbol) {
-				if (sym is Delegate) {
-					type = new DelegateType ((Delegate) sym);
-				} else {
-					type.data_type = (Typesymbol) sym;
-				}
-			} else {
-				Report.error (type.source_reference, "`%s' is not a type".printf (sym.get_full_name ()));
-				return new InvalidType ();
-			}
+			return sym;
 		} else {
-			var ns_symbol = root_symbol.scope.lookup (unresolved_type.namespace_name);
-			if (ns_symbol == null) {
-				type.error = true;
-				Report.error (type.source_reference, "The namespace name `%s' could not be found".printf (unresolved_type.namespace_name));
-				return new InvalidType ();
-			}
-			
-			var sym = ns_symbol.scope.lookup (unresolved_type.type_name);
-			if (sym == null) {
-				Report.error (type.source_reference, "The type name `%s' does not exist in the namespace `%s'".printf (unresolved_type.type_name, unresolved_type.namespace_name));
-				return new InvalidType ();
+			var parent_symbol = resolve_symbol (unresolved_symbol.inner);
+			if (parent_symbol == null) {
+				unresolved_symbol.error = true;
+				Report.error (unresolved_symbol.inner.source_reference, "The symbol `%s' could not be found".printf (unresolved_symbol.inner.name));
+				return null;
 			}
-			if (sym is Typesymbol) {
-				if (sym is Delegate) {
-					type = new DelegateType ((Delegate) sym);
-				} else {
-					type.data_type = (Typesymbol) sym;
-				}
+
+			return parent_symbol.scope.lookup (unresolved_symbol.name);
+		}
+	}
+
+	private DataType! resolve_type (UnresolvedType! unresolved_type) {
+		var type = new DataType ();
+		type.source_reference = unresolved_type.source_reference;
+		type.takes_ownership = unresolved_type.takes_ownership;
+		type.transfers_ownership = unresolved_type.transfers_ownership;
+		type.is_ref = unresolved_type.is_ref;
+		type.is_out = unresolved_type.is_out;
+		type.nullable = unresolved_type.nullable;
+		type.requires_null_check = unresolved_type.requires_null_check;
+		foreach (DataType type_arg in unresolved_type.get_type_arguments ()) {
+			type.add_type_argument (type_arg);
+		}
+
+		// still required for vapigen
+		if (unresolved_type.unresolved_symbol.name == "void") {
+			return new VoidType ();
+		}
+
+		var sym = resolve_symbol (unresolved_type.unresolved_symbol);
+		if (sym == null) {
+			// don't report same error twice
+			if (!unresolved_type.unresolved_symbol.error) {
+				Report.error (type.source_reference, "The type name `%s' could not be found".printf (unresolved_type.unresolved_symbol.to_string ()));
+			}
+			return new InvalidType ();
+		}
+
+		if (sym is TypeParameter) {
+			type.type_parameter = (TypeParameter) sym;
+		} else if (sym is Typesymbol) {
+			if (sym is Delegate) {
+				type = new DelegateType ((Delegate) sym);
 			} else {
-				Report.error (type.source_reference, "`%s' is not a type".printf (sym.get_full_name ()));
-				return new InvalidType ();
+				type.data_type = (Typesymbol) sym;
 			}
+		} else {
+			Report.error (type.source_reference, "`%s' is not a type".printf (sym.get_full_name ()));
+			return new InvalidType ();
 		}
 
 		for (int pointer_level = unresolved_type.pointer_level; pointer_level > 0; pointer_level--) {

Added: trunk/vala/valaunresolvedsymbol.vala
==============================================================================
--- (empty file)
+++ trunk/vala/valaunresolvedsymbol.vala	Sun Feb 24 15:15:07 2008
@@ -0,0 +1,57 @@
+/* valaunresolvedsymbol.vala
+ *
+ * Copyright (C) 2008  JÃrg Billeter
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
+ *
+ * Author:
+ * 	JÃrg Billeter <j bitron ch>
+ */
+
+using GLib;
+
+/**
+ * An unresolved reference to a symbol.
+ */
+public class Vala.UnresolvedSymbol : CodeNode {
+	/**
+	 * The parent of the symbol or null.
+	 */
+	public UnresolvedSymbol? inner { get; set; }
+
+	/**
+	 * The symbol name.
+	 */
+	public string name { get; set; }
+
+	public UnresolvedSymbol (UnresolvedSymbol? inner, string name, SourceReference? source_reference = null) {
+		this.inner = inner;
+		this.name = name;
+		this.source_reference = source_reference;
+	}
+
+	public override string to_string () {
+		if (inner == null) {
+			return name;
+		} else {
+			return "%s.%s".printf (inner.to_string (), name);
+		}
+	}
+
+	public UnresolvedSymbol copy () {
+		return new UnresolvedSymbol (inner, name, source_reference);
+	}
+}
+

Modified: trunk/vala/valaunresolvedtype.vala
==============================================================================
--- trunk/vala/valaunresolvedtype.vala	(original)
+++ trunk/vala/valaunresolvedtype.vala	Sun Feb 24 15:15:07 2008
@@ -29,15 +29,10 @@
  */
 public class Vala.UnresolvedType : DataType {
 	/**
-	 * The name of the namespace containing the referred data type.
+	 * The unresolved reference to a type symbol.
 	 */
-	public string namespace_name { get; set; }
-	
-	/**
-	 * The name of the referred data type.
-	 */
-	public string type_name { get; set; }
-	
+	public UnresolvedSymbol unresolved_symbol { get; set; }
+
 	/**
 	 * Specifies the rank of the array this reference is possibly referring
 	 * to. "0" indicates no array.
@@ -61,14 +56,12 @@
 	/**
 	 * Creates a new type reference.
 	 *
-	 * @param ns        optional namespace name
-	 * @param type_name type symbol name
+	 * @param symbol    unresolved type symbol
 	 * @param source    reference to source code
 	 * @return          newly created type reference
 	 */
-	public UnresolvedType.from_name (string ns, string! type, SourceReference source = null) {
-		namespace_name = ns;
-		type_name = type;
+	public UnresolvedType.from_symbol (UnresolvedSymbol symbol, SourceReference source = null) {
+		this.unresolved_symbol = symbol;
 		source_reference = source;
 	}
 
@@ -89,10 +82,10 @@
 			if (ma.inner != null) {
 				if (ma.inner is MemberAccess) {
 					var simple = (MemberAccess) ma.inner;
-					type_ref = new UnresolvedType.from_name (simple.member_name, ma.member_name, ma.source_reference);
+					type_ref = new UnresolvedType.from_symbol (new UnresolvedSymbol (new UnresolvedSymbol (null, simple.member_name, ma.source_reference), ma.member_name, ma.source_reference), ma.source_reference);
 				}
 			} else {
-				type_ref = new UnresolvedType.from_name (null, ma.member_name, ma.source_reference);
+				type_ref = new UnresolvedType.from_symbol (new UnresolvedSymbol (null, ma.member_name, ma.source_reference), ma.source_reference);
 			}
 			
 			if (type_ref != null) {
@@ -117,8 +110,7 @@
 		result.is_out = is_out;
 		result.nullable = nullable;
 		result.requires_null_check = requires_null_check;
-		result.namespace_name = namespace_name;
-		result.type_name = type_name;
+		result.unresolved_symbol = unresolved_symbol.copy ();
 		result.array_rank = array_rank;
 		result.pointer_level = pointer_level;
 		result.is_ref = is_ref;

Modified: trunk/vapi/atk.vapi
==============================================================================
--- trunk/vapi/atk.vapi	(original)
+++ trunk/vapi/atk.vapi	Sun Feb 24 15:15:07 2008
@@ -247,7 +247,7 @@
 		public uint state;
 		public uint keyval;
 		public int length;
-		public weak string string;
+		public weak string str;
 		public ushort keycode;
 		public uint timestamp;
 	}
@@ -511,10 +511,10 @@
 		public abstract void copy_text (int start_pos, int end_pos);
 		public abstract void cut_text (int start_pos, int end_pos);
 		public abstract void delete_text (int start_pos, int end_pos);
-		public abstract void insert_text (string string, int length, int position);
+		public abstract void insert_text (string str, int length, int position);
 		public abstract void paste_text (int position);
 		public abstract bool set_run_attributes (Atk.AttributeSet attrib_set, int start_offset, int end_offset);
-		public abstract void set_text_contents (string string);
+		public abstract void set_text_contents (string str);
 	}
 	[CCode (cheader_filename = "atk/atk.h")]
 	public interface HyperlinkImpl {

Modified: trunk/vapi/gdk-2.0.vapi
==============================================================================
--- trunk/vapi/gdk-2.0.vapi	(original)
+++ trunk/vapi/gdk-2.0.vapi	Sun Feb 24 15:15:07 2008
@@ -654,7 +654,7 @@
 		public uint state;
 		public uint keyval;
 		public int length;
-		public weak string string;
+		public weak string str;
 		public ushort hardware_keycode;
 		public uchar group;
 		public uint is_modifier;

Modified: trunk/vapi/glib-2.0.vapi
==============================================================================
--- trunk/vapi/glib-2.0.vapi	(original)
+++ trunk/vapi/glib-2.0.vapi	Sun Feb 24 15:15:07 2008
@@ -1635,18 +1635,18 @@
 		[NoArrayLength ()]
 		public void set_seed_array (uint32[] seed, uint seed_length);
 		public bool boolean ();
-		public uint32 @int ();
+		public uint32 next_int ();
 		public int32 int_range (int32 begin, int32 end);
-		public double @double ();
+		public double next_double ();
 		public double double_range (double begin, double end);
 	}
 	
 	public static class Random {
 		public static void set_seed (uint32 seed);
 		public static bool boolean ();
-		public static uint32 @int ();
+		public static uint32 next_int ();
 		public static int32 int_range (int32 begin, int32 end);
-		public static double @double ();
+		public static double next_double ();
 		public static double double_range (double begin, double end);
 	}
 	
@@ -2223,21 +2223,21 @@
 		public int get_max_backref ();
 		public int get_capture_count ();
 		public int get_string_number (string! name);
-		public string! escape_string (string! string, int length = -1);
-		public static bool match_simple (string! pattern, string! string, RegexCompileFlags compile_options = 0, RegexMatchFlags match_options = 0);
-		public bool match (string! string, RegexMatchFlags match_options = 0, out MatchInfo match_info = null);
-		public bool match_full (string! string, long string_len = -1, int start_position = 0, RegexMatchFlags match_options = 0, out MatchInfo match_info = null) throws RegexError;
-		public bool match_all (string! string, RegexMatchFlags match_options = 0, out MatchInfo match_info = null);
-		public bool match_all_full (string! string, long string_len = -1, int start_position = 0, RegexMatchFlags match_options = 0, out MatchInfo match_info = null) throws RegexError;
+		public string! escape_string (string! str, int length = -1);
+		public static bool match_simple (string! pattern, string! str, RegexCompileFlags compile_options = 0, RegexMatchFlags match_options = 0);
+		public bool match (string! str, RegexMatchFlags match_options = 0, out MatchInfo match_info = null);
+		public bool match_full (string! str, long string_len = -1, int start_position = 0, RegexMatchFlags match_options = 0, out MatchInfo match_info = null) throws RegexError;
+		public bool match_all (string! str, RegexMatchFlags match_options = 0, out MatchInfo match_info = null);
+		public bool match_all_full (string! str, long string_len = -1, int start_position = 0, RegexMatchFlags match_options = 0, out MatchInfo match_info = null) throws RegexError;
 		[NoArrayLength]
-		public static string[] split_simple (string! pattern, string! string, RegexCompileFlags compile_options = 0, RegexMatchFlags match_options = 0);
+		public static string[] split_simple (string! pattern, string! str, RegexCompileFlags compile_options = 0, RegexMatchFlags match_options = 0);
 		[NoArrayLength]
-		public string[] split (string! string, RegexMatchFlags match_options = 0);
+		public string[] split (string! str, RegexMatchFlags match_options = 0);
 		[NoArrayLength]
-		public bool split_full (string! string, long string_len = -1, int start_position = 0, RegexMatchFlags match_options = 0, int max_tokens = 0) throws RegexError;
-		public string replace (string! string, long string_len, int start_position, string! replacement, RegexMatchFlags match_options = 0) throws RegexError;
-		public string replace_literal (string! string, long string_len, int start_position, string! replacement, RegexMatchFlags match_options = 0) throws RegexError;
-		public string replace_eval (string! string, long string_len, int start_position, RegexMatchFlags match_options = 0, RegexEvalCallback eval, pointer user_data) throws RegexError;
+		public bool split_full (string! str, long string_len = -1, int start_position = 0, RegexMatchFlags match_options = 0, int max_tokens = 0) throws RegexError;
+		public string replace (string! str, long string_len, int start_position, string! replacement, RegexMatchFlags match_options = 0) throws RegexError;
+		public string replace_literal (string! str, long string_len, int start_position, string! replacement, RegexMatchFlags match_options = 0) throws RegexError;
+		public string replace_eval (string! str, long string_len, int start_position, RegexMatchFlags match_options = 0, RegexEvalCallback eval, pointer user_data) throws RegexError;
 		public static bool check_replacement (out bool has_references = null) throws RegexError;
 	}
 
@@ -2355,8 +2355,8 @@
 		public double[] get_double_list (string! group_name, string! key) throws KeyFileError;
 		public string get_comment (string! group_name, string! key) throws KeyFileError;
 		public void set_value (string! group_name, string! key, string! value);
-		public void set_string (string! group_name, string! key, string! string);
-		public void set_locale_string (string! group_name, string! key, string! locale, string! string);
+		public void set_string (string! group_name, string! key, string! str);
+		public void set_locale_string (string! group_name, string! key, string! locale, string! str);
 		public void set_boolean (string! group_name, string! key, bool value);
 		public void set_integer (string! group_name, string! key, int value);
 		public void set_double (string! group_name, string! key, double value);
@@ -2796,7 +2796,7 @@
 	/* Quarks */
 	
 	public struct Quark : uint32 {
-		public static Quark from_string (string string);
+		public static Quark from_string (string str);
 		public weak string to_string ();
 	}
 

Modified: trunk/vapi/gnome-desktop-2.0.vapi
==============================================================================
--- trunk/vapi/gnome-desktop-2.0.vapi	(original)
+++ trunk/vapi/gnome-desktop-2.0.vapi	Sun Feb 24 15:15:07 2008
@@ -76,7 +76,7 @@
 		public DesktopItem ();
 		public DesktopItem.from_basename (string basename, Gnome.DesktopItemLoadFlags flags) throws GLib.Error;
 		public DesktopItem.from_file (string file, Gnome.DesktopItemLoadFlags flags) throws GLib.Error;
-		public DesktopItem.from_string (string uri, string string, long length, Gnome.DesktopItemLoadFlags flags) throws GLib.Error;
+		public DesktopItem.from_string (string uri, string str, long length, Gnome.DesktopItemLoadFlags flags) throws GLib.Error;
 		public DesktopItem.from_uri (string uri, Gnome.DesktopItemLoadFlags flags) throws GLib.Error;
 		public bool save (string under, bool force) throws GLib.Error;
 		public void set_boolean (string attr, bool value);

Modified: trunk/vapi/gnome-vfs-2.0.vapi
==============================================================================
--- trunk/vapi/gnome-vfs-2.0.vapi	(original)
+++ trunk/vapi/gnome-vfs-2.0.vapi	Sun Feb 24 15:15:07 2008
@@ -1058,11 +1058,11 @@
 	[CCode (cheader_filename = "libgnomevfs/gnome-vfs.h")]
 	public static weak string escape_path_string (string path);
 	[CCode (cheader_filename = "libgnomevfs/gnome-vfs.h")]
-	public static weak string escape_set (string string, string match_set);
+	public static weak string escape_set (string str, string match_set);
 	[CCode (cheader_filename = "libgnomevfs/gnome-vfs.h")]
-	public static weak string escape_slashes (string string);
+	public static weak string escape_slashes (string str);
 	[CCode (cheader_filename = "libgnomevfs/gnome-vfs.h")]
-	public static weak string escape_string (string string);
+	public static weak string escape_string (string str);
 	[CCode (cheader_filename = "libgnomevfs/gnome-vfs.h")]
 	public static weak string expand_initial_tilde (string path);
 	[CCode (cheader_filename = "libgnomevfs/gnome-vfs.h")]

Modified: trunk/vapi/gstreamer-0.10.vapi
==============================================================================
--- trunk/vapi/gstreamer-0.10.vapi	(original)
+++ trunk/vapi/gstreamer-0.10.vapi	Sun Feb 24 15:15:07 2008
@@ -825,7 +825,7 @@
 	[CCode (cheader_filename = "gst/gst.h")]
 	public class StaticCaps {
 		public weak Gst.Caps caps;
-		public weak string string;
+		public weak string str;
 		[NoArrayLength]
 		public weak pointer[] _gst_reserved;
 		public weak Gst.Caps get ();
@@ -946,7 +946,7 @@
 		public weak Gst.Caps copy ();
 		public weak Gst.Caps copy_nth (uint nth);
 		public bool do_simplify ();
-		public static weak Gst.Caps from_string (string string);
+		public static weak Gst.Caps from_string (string str);
 		public uint get_size ();
 		public weak Gst.Structure get_structure (uint index);
 		public weak Gst.Caps intersect (Gst.Caps caps2);
@@ -1031,7 +1031,7 @@
 		public bool fixate_field_nearest_fraction (string field_name, int target_numerator, int target_denominator);
 		public bool fixate_field_nearest_int (string field_name, int target);
 		public bool @foreach (Gst.StructureForeachFunc func);
-		public static weak Gst.Structure from_string (string string, string end);
+		public static weak Gst.Structure from_string (string str, string end);
 		public bool get_boolean (string fieldname, out bool value);
 		public bool get_clock_time (string fieldname, Gst.ClockTime value);
 		public bool get_date (string fieldname, out weak GLib.Date value);

Modified: trunk/vapi/gtk+-2.0.vapi
==============================================================================
--- trunk/vapi/gtk+-2.0.vapi	(original)
+++ trunk/vapi/gtk+-2.0.vapi	Sun Feb 24 15:15:07 2008
@@ -1728,7 +1728,7 @@
 		public ushort accel_string_width;
 		public weak Gtk.Widget get_accel_widget ();
 		public uint get_accel_width ();
-		public AccelLabel (string string);
+		public AccelLabel (string str);
 		public bool refetch ();
 		public void set_accel_closure (GLib.Closure accel_closure);
 		public void set_accel_widget (Gtk.Widget accel_widget);
@@ -1833,7 +1833,7 @@
 		public void set_translate_func (Gtk.TranslateFunc func, pointer data, Gtk.DestroyNotify notify);
 		public void set_translation_domain (string domain);
 		public void set_visible (bool visible);
-		public weak string translate_string (string string);
+		public weak string translate_string (string str);
 		public virtual weak Gtk.Action get_action (string action_name);
 		[NoAccessorMethod]
 		public weak string name { get; construct; }
@@ -1978,8 +1978,8 @@
 		public weak string get_translation_domain ();
 		public Builder ();
 		public void set_translation_domain (string domain);
-		public bool value_from_string (GLib.ParamSpec pspec, string string, GLib.Value value) throws GLib.Error;
-		public bool value_from_string_type (GLib.Type type, string string, GLib.Value value) throws GLib.Error;
+		public bool value_from_string (GLib.ParamSpec pspec, string str, GLib.Value value) throws GLib.Error;
+		public bool value_from_string_type (GLib.Type type, string str, GLib.Value value) throws GLib.Error;
 		public virtual GLib.Type get_type_from_name (string type_name);
 		public weak string translation_domain { get; set; }
 	}
@@ -4637,7 +4637,7 @@
 		[NoWrapper]
 		public virtual void draw_slider (Gdk.Window window, Gtk.StateType state_type, Gtk.ShadowType shadow_type, Gdk.Rectangle area, Gtk.Widget widget, string detail, int x, int y, int width, int height, Gtk.Orientation orientation);
 		[NoWrapper]
-		public virtual void draw_string (Gdk.Window window, Gtk.StateType state_type, Gdk.Rectangle area, Gtk.Widget widget, string detail, int x, int y, string string);
+		public virtual void draw_string (Gdk.Window window, Gtk.StateType state_type, Gdk.Rectangle area, Gtk.Widget widget, string detail, int x, int y, string str);
 		[NoWrapper]
 		public virtual void draw_tab (Gdk.Window window, Gtk.StateType state_type, Gtk.ShadowType shadow_type, Gdk.Rectangle area, Gtk.Widget widget, string detail, int x, int y, int width, int height);
 		[NoWrapper]

Modified: trunk/vapi/libglade-2.0.vapi
==============================================================================
--- trunk/vapi/libglade-2.0.vapi	(original)
+++ trunk/vapi/libglade-2.0.vapi	Sun Feb 24 15:15:07 2008
@@ -84,7 +84,7 @@
 		public void set_common_params (Gtk.Widget widget, Glade.WidgetInfo info);
 		public void set_packing_property (Gtk.Widget parent, Gtk.Widget child, string name, string value);
 		public void set_toplevel (Gtk.Window window);
-		public bool set_value_from_string (GLib.ParamSpec pspec, string string, GLib.Value value);
+		public bool set_value_from_string (GLib.ParamSpec pspec, string str, GLib.Value value);
 		public void signal_autoconnect ();
 		public void signal_autoconnect_full (Glade.XMLConnectFunc func);
 		public void signal_connect (string handlername, GLib.Callback func);
@@ -101,9 +101,9 @@
 	public delegate weak Gtk.Widget XMLCustomWidgetHandler (Glade.XML xml, string func_name, string name, string string1, string string2, int int1, int int2);
 	public const int MODULE_API_VERSION;
 	[CCode (cheader_filename = "glade/glade.h")]
-	public static int enum_from_string (GLib.Type type, string string);
+	public static int enum_from_string (GLib.Type type, string str);
 	[CCode (cheader_filename = "glade/glade.h")]
-	public static uint flags_from_string (GLib.Type type, string string);
+	public static uint flags_from_string (GLib.Type type, string str);
 	[CCode (cheader_filename = "glade/glade.h")]
 	public static weak string get_widget_name (Gtk.Widget widget);
 	[CCode (cheader_filename = "glade/glade.h")]

Modified: trunk/vapi/libgnomeui-2.0.vapi
==============================================================================
--- trunk/vapi/libgnomeui-2.0.vapi	(original)
+++ trunk/vapi/libgnomeui-2.0.vapi	Sun Feb 24 15:15:07 2008
@@ -223,7 +223,7 @@
 		public static void fill_toolbar_custom (Gtk.Toolbar toolbar, Gnome.UIInfo uiinfo, Gnome.UIBuilderData uibdata, Gtk.AccelGroup accel_group);
 		public static void fill_toolbar_with_data (Gtk.Toolbar toolbar, Gnome.UIInfo uiinfo, Gtk.AccelGroup accel_group);
 		public static weak Gtk.Widget find_menu_pos (Gtk.Widget parent, string path, int pos);
-		public static weak string helper_gettext (string string);
+		public static weak string helper_gettext (string str);
 		public void insert_menus (string path, Gnome.UIInfo menuinfo);
 		public void insert_menus_custom (string path, Gnome.UIInfo uiinfo, Gnome.UIBuilderData uibdata);
 		public void insert_menus_interp (string path, Gnome.UIInfo menuinfo, Gtk.CallbackMarshal relay_func, pointer data, Gtk.DestroyNotify destroy_func);
@@ -485,7 +485,7 @@
 	public static delegate void InteractFunction (Gnome.Client client, int key, Gnome.DialogType dialog_type, pointer data);
 	public delegate double PasswordDialogQualityFunc (Gnome.PasswordDialog password_dialog, string password);
 	public static delegate void ReplyCallback (int reply, pointer data);
-	public static delegate void StringCallback (string string, pointer data);
+	public static delegate void StringCallback (string str, pointer data);
 	public static delegate void UISignalConnectFunc (Gnome.UIInfo uiinfo, string signal_name, Gnome.UIBuilderData uibdata);
 	public const string GNOMEUIINFO_KEY_UIBDATA;
 	public const string GNOMEUIINFO_KEY_UIDATA;

Modified: trunk/vapi/packages/gtk+-2.0/gtk+-2.0.metadata
==============================================================================
--- trunk/vapi/packages/gtk+-2.0/gtk+-2.0.metadata	(original)
+++ trunk/vapi/packages/gtk+-2.0/gtk+-2.0.metadata	Sun Feb 24 15:15:07 2008
@@ -258,8 +258,8 @@
 GtkWidget::child_notify has_emitter="1"
 GtkWidget::grab_focus has_emitter="1"
 GtkWidget::hide has_emitter="1"
-GtkWidget::key_press_event.event type_name="EventKey"
-GtkWidget::key_release_event.event type_name="EventKey"
+GtkWidget::key_press_event.event namespace_name="Gdk" type_name="EventKey"
+GtkWidget::key_release_event.event namespace_name="Gdk" type_name="EventKey"
 GtkWidget::keynav_failed has_emitter="1"
 GtkWidget::map has_emitter="1"
 GtkWidget::mnemonic_activate has_emitter="1"

Modified: trunk/vapi/webkit-1.0.vapi
==============================================================================
--- trunk/vapi/webkit-1.0.vapi	(original)
+++ trunk/vapi/webkit-1.0.vapi	Sun Feb 24 15:15:07 2008
@@ -135,11 +135,11 @@
 		public bool has_selection ();
 		public void load_html_string (string content, string base_uri);
 		public void load_string (string content, string content_mime_type, string content_encoding, string base_uri);
-		public uint mark_text_matches (string string, bool case_sensitive, uint limit);
+		public uint mark_text_matches (string str, bool case_sensitive, uint limit);
 		public WebView ();
 		public void open (string uri);
 		public void reload ();
-		public bool search_text (string string, bool case_sensitive, bool forward, bool wrap);
+		public bool search_text (string str, bool case_sensitive, bool forward, bool wrap);
 		public void set_editable (bool flag);
 		public void set_highlight_text_matches (bool highlight);
 		public void set_maintains_back_forward_list (bool flag);

Modified: trunk/vapigen/valagidlparser.vala
==============================================================================
--- trunk/vapigen/valagidlparser.vala	(original)
+++ trunk/vapigen/valagidlparser.vala	Sun Feb 24 15:15:07 2008
@@ -301,7 +301,13 @@
 				// hide user_data parameter for instance delegates
 				cb.instance = true;
 			} else {
-				var p = new FormalParameter (param_node.name, parse_param (param));
+				string param_name = param_node.name;
+				if (param_name == "string") {
+					// avoid conflict with string type
+					param_name = "str";
+				}
+
+				var p = new FormalParameter (param_name, parse_param (param));
 				cb.add_parameter (p);
 			}
 		}
@@ -644,10 +650,8 @@
 				current_source_file.add_node (cl);
 			}
 
-			var parent = new UnresolvedType ();
-			parent.namespace_name = "GLib";
-			parent.type_name = "Boxed";
-			cl.add_base_type (parent);
+			var gboxed_symbol = new UnresolvedSymbol (new UnresolvedSymbol (null, "GLib"), "Boxed");
+			cl.add_base_type (new UnresolvedType.from_symbol (gboxed_symbol));
 
 			current_data_type = cl;
 
@@ -791,10 +795,8 @@
 			parse_type_string (parent, node.parent);
 			cl.add_base_type (parent);
 		} else {
-			var parent = new UnresolvedType ();
-			parent.namespace_name = "GLib";
-			parent.type_name = "Object";
-			cl.add_base_type (parent);
+			var gobject_symbol = new UnresolvedSymbol (new UnresolvedSymbol (null, "GLib"), "Object");
+			cl.add_base_type (new UnresolvedType.from_symbol (gobject_symbol));
 		}
 		
 		foreach (string iface_name in node.interfaces) {
@@ -950,63 +952,59 @@
 		var type = new UnresolvedType ();
 		if (type_node.tag == TypeTag.VOID) {
 			if (type_node.is_pointer) {
-				type.type_name = "pointer";
+				type.unresolved_symbol = new UnresolvedSymbol (null, "pointer");
 			} else {
-				type.type_name = "void";
+				type.unresolved_symbol = new UnresolvedSymbol (null, "void");
 			}
 		} else if (type_node.tag == TypeTag.BOOLEAN) {
-			type.type_name = "bool";
+			type.unresolved_symbol = new UnresolvedSymbol (null, "bool");
 		} else if (type_node.tag == TypeTag.INT8) {
-			type.type_name = "char";
+			type.unresolved_symbol = new UnresolvedSymbol (null, "char");
 		} else if (type_node.tag == TypeTag.UINT8) {
-			type.type_name = "uchar";
+			type.unresolved_symbol = new UnresolvedSymbol (null, "uchar");
 		} else if (type_node.tag == TypeTag.INT16) {
-			type.type_name = "short";
+			type.unresolved_symbol = new UnresolvedSymbol (null, "short");
 		} else if (type_node.tag == TypeTag.UINT16) {
-			type.type_name = "ushort";
+			type.unresolved_symbol = new UnresolvedSymbol (null, "ushort");
 		} else if (type_node.tag == TypeTag.INT32) {
-			type.type_name = "int";
+			type.unresolved_symbol = new UnresolvedSymbol (null, "int");
 		} else if (type_node.tag == TypeTag.UINT32) {
-			type.type_name = "uint";
+			type.unresolved_symbol = new UnresolvedSymbol (null, "uint");
 		} else if (type_node.tag == TypeTag.INT64) {
-			type.type_name = "int64";
+			type.unresolved_symbol = new UnresolvedSymbol (null, "int64");
 		} else if (type_node.tag == TypeTag.UINT64) {
-			type.type_name = "uint64";
+			type.unresolved_symbol = new UnresolvedSymbol (null, "uint64");
 		} else if (type_node.tag == TypeTag.INT) {
-			type.type_name = "int";
+			type.unresolved_symbol = new UnresolvedSymbol (null, "int");
 		} else if (type_node.tag == TypeTag.UINT) {
-			type.type_name = "uint";
+			type.unresolved_symbol = new UnresolvedSymbol (null, "uint");
 		} else if (type_node.tag == TypeTag.LONG) {
-			type.type_name = "long";
+			type.unresolved_symbol = new UnresolvedSymbol (null, "long");
 		} else if (type_node.tag == TypeTag.ULONG) {
-			type.type_name = "ulong";
+			type.unresolved_symbol = new UnresolvedSymbol (null, "ulong");
 		} else if (type_node.tag == TypeTag.SSIZE) {
-			type.type_name = "long";
+			type.unresolved_symbol = new UnresolvedSymbol (null, "long");
 		} else if (type_node.tag == TypeTag.SIZE) {
-			type.type_name = "ulong";
+			type.unresolved_symbol = new UnresolvedSymbol (null, "ulong");
 		} else if (type_node.tag == TypeTag.FLOAT) {
-			type.type_name = "float";
+			type.unresolved_symbol = new UnresolvedSymbol (null, "float");
 		} else if (type_node.tag == TypeTag.DOUBLE) {
-			type.type_name = "double";
+			type.unresolved_symbol = new UnresolvedSymbol (null, "double");
 		} else if (type_node.tag == TypeTag.UTF8) {
-			type.type_name = "string";
+			type.unresolved_symbol = new UnresolvedSymbol (null, "string");
 		} else if (type_node.tag == TypeTag.FILENAME) {
-			type.type_name = "string";
+			type.unresolved_symbol = new UnresolvedSymbol (null, "string");
 		} else if (type_node.tag == TypeTag.ARRAY) {
 			type = parse_type (type_node.parameter_type1);
 			type.array_rank = 1;
 		} else if (type_node.tag == TypeTag.LIST) {
-			type.namespace_name = "GLib";
-			type.type_name = "List";
+			type.unresolved_symbol = new UnresolvedSymbol (new UnresolvedSymbol (null, "GLib"), "List");
 		} else if (type_node.tag == TypeTag.SLIST) {
-			type.namespace_name = "GLib";
-			type.type_name = "SList";
+			type.unresolved_symbol = new UnresolvedSymbol (new UnresolvedSymbol (null, "GLib"), "SList");
 		} else if (type_node.tag == TypeTag.HASH) {
-			type.namespace_name = "GLib";
-			type.type_name = "HashTable";
+			type.unresolved_symbol = new UnresolvedSymbol (new UnresolvedSymbol (null, "GLib"), "HashTable");
 		} else if (type_node.tag == TypeTag.ERROR) {
-			type.namespace_name = "GLib";
-			type.type_name = "Error";
+			type.unresolved_symbol = new UnresolvedSymbol (new UnresolvedSymbol (null, "GLib"), "Error");
 		} else if (type_node.is_interface) {
 			var n = type_node  interface;
 			
@@ -1020,50 +1018,47 @@
 
 			if (type_node.is_pointer &&
 			    (n == "gchar" || n == "char")) {
-				type.type_name = "string";
+				type.unresolved_symbol = new UnresolvedSymbol (null, "string");
 				if (type_node.unparsed.has_suffix ("**")) {
 					type.is_out = true;
 				}
 			} else if (n == "gunichar") {
-				type.type_name = "unichar";
+				type.unresolved_symbol = new UnresolvedSymbol (null, "unichar");
 			} else if (n == "gchar") {
-				type.type_name = "char";
+				type.unresolved_symbol = new UnresolvedSymbol (null, "char");
 			} else if (n == "guchar" || n == "guint8") {
-				type.type_name = "uchar";
+				type.unresolved_symbol = new UnresolvedSymbol (null, "uchar");
 				if (type_node.is_pointer) {
 					type.array_rank = 1;
 				}
 			} else if (n == "gushort") {
-				type.type_name = "ushort";
+				type.unresolved_symbol = new UnresolvedSymbol (null, "ushort");
 			} else if (n == "gshort") {
-				type.type_name = "short";
+				type.unresolved_symbol = new UnresolvedSymbol (null, "short");
 			} else if (n == "gconstpointer" || n == "void") {
-				type.type_name = "pointer";
+				type.unresolved_symbol = new UnresolvedSymbol (null, "pointer");
 			} else if (n == "goffset" || n == "off_t") {
-				type.type_name = "int64";
+				type.unresolved_symbol = new UnresolvedSymbol (null, "int64");
 			} else if (n == "value_array") {
-				type.namespace_name = "GLib";
-				type.type_name = "ValueArray";
+				type.unresolved_symbol = new UnresolvedSymbol (new UnresolvedSymbol (null, "GLib"), "ValueArray");
 			} else if (n == "time_t") {
-				type.type_name = "ulong";
+				type.unresolved_symbol = new UnresolvedSymbol (null, "ulong");
 			} else if (n == "socklen_t") {
-				type.type_name = "uint32";
+				type.unresolved_symbol = new UnresolvedSymbol (null, "uint32");
 			} else if (n == "mode_t") {
-				type.type_name = "uint";
+				type.unresolved_symbol = new UnresolvedSymbol (null, "uint");
 			} else if (n == "gint" || n == "pid_t") {
-				type.type_name = "int";
+				type.unresolved_symbol = new UnresolvedSymbol (null, "int");
 			} else if (n == "unsigned" || n == "unsigned-int") {
-				type.type_name = "uint";
+				type.unresolved_symbol = new UnresolvedSymbol (null, "uint");
 			} else if (n == "FILE") {
-				type.namespace_name = "GLib";
-				type.type_name = "FileStream";
+				type.unresolved_symbol = new UnresolvedSymbol (new UnresolvedSymbol (null, "GLib"), "FileStream");
 			} else if (n == "struct") {
-				type.type_name = "pointer";
+				type.unresolved_symbol = new UnresolvedSymbol (null, "pointer");
 			} else if (n == "iconv_t") {
-				type.type_name = "pointer";
+				type.unresolved_symbol = new UnresolvedSymbol (null, "pointer");
 			} else if (n == "GType") {
-				type.namespace_name = "GLib";
-				type.type_name = "Type";
+				type.unresolved_symbol = new UnresolvedSymbol (new UnresolvedSymbol (null, "GLib"), "Type");
 				if (type_node.is_pointer) {
 					type.array_rank = 1;
 				}
@@ -1095,49 +1090,54 @@
 	private void parse_type_string (UnresolvedType! type, string! n) {
 		var dt = cname_type_map[n];
 		if (dt != null) {
-			type.namespace_name = dt.parent_symbol.name;
-			type.type_name = dt.name;
+			UnresolvedSymbol parent_symbol = null;
+			if (dt.parent_symbol.name != null) {
+				parent_symbol = new UnresolvedSymbol (null, dt.parent_symbol.name);
+			}
+			type.unresolved_symbol = new UnresolvedSymbol (parent_symbol, dt.name);
 			return;
 		}
 
 		var type_attributes = get_attributes (n);
 
+		string ns_name = null;
+
 		if (null != type_attributes) {
 			foreach (string attr in type_attributes) {
 				var nv = attr.split ("=", 2);
 
 				if (nv[0] == "cprefix") {
-					type.type_name = n.offset (eval (nv[1]).len ());
+					type.unresolved_symbol = new UnresolvedSymbol (null, n.offset (eval (nv[1]).len ()));
 				} else if (nv[0] == "name") {
-					type.type_name = eval (nv[1]);
+					type.unresolved_symbol = new UnresolvedSymbol (null, eval (nv[1]));
 				} else if (nv[0] == "namespace") {
-					type.namespace_name = eval (nv[1]);
+					ns_name = eval (nv[1]);
 				} else if (nv[0] == "rename_to") {
-					type.type_name = eval (nv[1]);
+					type.unresolved_symbol = new UnresolvedSymbol (null, eval (nv[1]));
 				}
 			}
 		}
 
-		if (type.type_name != null) {
+		if (type.unresolved_symbol != null) {
+			if (ns_name != null) {
+				type.unresolved_symbol.inner = new UnresolvedSymbol (null, ns_name);
+			}
 			return;
 		}
 
 		if (n == "va_list") {
 			// unsupported
-			type.type_name = "pointer";
+			type.unresolved_symbol = new UnresolvedSymbol (null, "pointer");
 		} else if (n.has_prefix (current_namespace.name)) {
-			type.namespace_name = current_namespace.name;
-			type.type_name = n.offset (current_namespace.name.len ());
+			type.unresolved_symbol = new UnresolvedSymbol (new UnresolvedSymbol (null, current_namespace.name), n.offset (current_namespace.name.len ()));
 		} else if (n.has_prefix ("G")) {
-			type.namespace_name = "GLib";
-			type.type_name = n.offset (1);
+			type.unresolved_symbol = new UnresolvedSymbol (new UnresolvedSymbol (null, "GLib"), n.offset (1));
 		} else {
 			var name_parts = n.split (".", 2);
 			if (name_parts[1] == null) {
-				type.type_name = name_parts[0];
+				type.unresolved_symbol = new UnresolvedSymbol (null, name_parts[0]);
 			} else {
-				type.namespace_name = name_parts[0];
-				type.type_name = name_parts[1];
+				type.unresolved_symbol = new UnresolvedSymbol (new UnresolvedSymbol (null, name_parts[0]), name_parts[1]);
 			}
 		}
 	}
@@ -1166,7 +1166,7 @@
 				m.name = m.name.offset ("new_".len ());
 			}
 		} else {
-			if (return_type.type_name == "void") {
+			if (return_type.unresolved_symbol.name == "void") {
 				m = new Method (name, new VoidType (), current_source_reference);
 			} else {
 				m = new Method (name, return_type, current_source_reference);
@@ -1263,6 +1263,9 @@
 			if (param_name == "result") {
 				// avoid conflict with generated result variable
 				param_name = "_result";
+			} else if (param_name == "string") {
+				// avoid conflict with string type
+				param_name = "str";
 			}
 			var param_type = parse_param (param);
 			var p = new FormalParameter (param_name, param_type);
@@ -1498,8 +1501,14 @@
 		if (current_type_symbol_set != null) {
 			current_type_symbol_set.add (node.name);
 		}
-		
-		var field = new Field (node.name, type, null, current_source_reference);
+
+		string field_name = node.name;
+		if (field_name == "string") {
+			// avoid conflict with string type
+			field_name = "str";
+		}
+
+		var field = new Field (field_name, type, null, current_source_reference);
 		field.access = SymbolAccessibility.PUBLIC;
 
 		field.no_array_length = true;
@@ -1585,6 +1594,7 @@
 
 			var attributes = get_attributes ("%s::%s.%s".printf (current_data_type.get_cname (), sig.name, param_node.name));
 			if (attributes != null) {
+				string ns_name = null;
 				foreach (string attr in attributes) {
 					var nv = attr.split ("=", 2);
 					if (nv[0] == "is_array") {
@@ -1606,11 +1616,14 @@
 							param_type.requires_null_check = true;
 						}
 					} else if (nv[0] == "type_name") {
-						param_type.type_name = eval (nv[1]);
+						param_type.unresolved_symbol = new UnresolvedSymbol (null, eval (nv[1]));
 					} else if (nv[0] == "namespace_name") {
-						param_type.namespace_name = eval (nv[1]);
+						ns_name = eval (nv[1]);
 					}
 				}
+				if (ns_name != null) {
+					param_type.unresolved_symbol.inner = new UnresolvedSymbol (null, ns_name);
+				}
 			}
 		}
 		



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