vala r1185 - in trunk: . gobject vala



Author: juergbi
Date: Mon Apr  7 22:16:25 2008
New Revision: 1185
URL: http://svn.gnome.org/viewvc/vala?rev=1185&view=rev

Log:
2008-04-07  Juerg Billeter  <j bitron ch>

	* vala/valaerrortype.vala, vala/valasemanticanalyzer.vala,
	  vala/valasymbolresolver.vala, gobject/valaccodegenerator.vala:
	  fix access to code and message fields in error types,
	  fixes bug 519648


Modified:
   trunk/ChangeLog
   trunk/gobject/valaccodegenerator.vala
   trunk/vala/valaerrortype.vala
   trunk/vala/valasemanticanalyzer.vala
   trunk/vala/valasymbolresolver.vala

Modified: trunk/gobject/valaccodegenerator.vala
==============================================================================
--- trunk/gobject/valaccodegenerator.vala	(original)
+++ trunk/gobject/valaccodegenerator.vala	Mon Apr  7 22:16:25 2008
@@ -226,7 +226,7 @@
 		gtype_type = (Typesymbol) glib_ns.scope.lookup ("Type");
 		gtypeinstance_type = (Typesymbol) glib_ns.scope.lookup ("TypeInstance");
 		gobject_type = (Typesymbol) glib_ns.scope.lookup ("Object");
-		gerror_type = new ErrorType (null);
+		gerror_type = new ErrorType (null, null);
 		glist_type = (Typesymbol) glib_ns.scope.lookup ("List");
 		gslist_type = (Typesymbol) glib_ns.scope.lookup ("SList");
 		gstring_type = (Typesymbol) glib_ns.scope.lookup ("StringBuilder");

Modified: trunk/vala/valaerrortype.vala
==============================================================================
--- trunk/vala/valaerrortype.vala	(original)
+++ trunk/vala/valaerrortype.vala	Mon Apr  7 22:16:25 2008
@@ -32,9 +32,10 @@
 	 */
 	public weak ErrorDomain? error_domain { get; set; }
 
-	public ErrorType (ErrorDomain? error_domain) {
+	public ErrorType (ErrorDomain? error_domain, SourceReference source_reference) {
 		this.error_domain = error_domain;
 		this.data_type = error_domain;
+		this.source_reference = source_reference;
 	}
 
 	public override bool compatible (DataType! target_type, bool enable_non_null = true) {
@@ -63,7 +64,7 @@
 	}
 
 	public override DataType copy () {
-		return new ErrorType (error_domain);
+		return new ErrorType (error_domain, source_reference);
 	}
 
 	public override string get_cname (bool var_type = false, bool const_type = false) {
@@ -91,4 +92,10 @@
 
 		return error_domain == et.error_domain;
 	}
+
+	public override Symbol? get_member (string member_name) {
+		var root_symbol = source_reference.file.context.root;
+		var gerror_symbol = root_symbol.scope.lookup ("GLib").scope.lookup ("Error");
+		return gerror_symbol.scope.lookup (member_name);
+	}
 }

Modified: trunk/vala/valasemanticanalyzer.vala
==============================================================================
--- trunk/vala/valasemanticanalyzer.vala	(original)
+++ trunk/vala/valasemanticanalyzer.vala	Mon Apr  7 22:16:25 2008
@@ -1168,7 +1168,7 @@
 
 			clause.body.scope.add (clause.variable_name, clause.variable_declarator);
 		} else {
-			clause.type_reference = new ErrorType (null);
+			clause.type_reference = new ErrorType (null, clause.source_reference);
 		}
 
 		clause.accept_children (this);
@@ -2183,7 +2183,7 @@
 				type = (Typesymbol) type_sym;
 				expr.type_reference = new ValueType (type);
 			} else if (type_sym is ErrorDomain) {
-				expr.type_reference = new ErrorType ((ErrorDomain) type_sym);
+				expr.type_reference = new ErrorType ((ErrorDomain) type_sym, expr.source_reference);
 			} else {
 				expr.error = true;
 				Report.error (expr.source_reference, "`%s' is not a class, struct, or error domain".printf (type_sym.get_full_name ()));

Modified: trunk/vala/valasymbolresolver.vala
==============================================================================
--- trunk/vala/valasymbolresolver.vala	(original)
+++ trunk/vala/valasymbolresolver.vala	Mon Apr  7 22:16:25 2008
@@ -243,7 +243,7 @@
 			} else if (sym is Class) {
 				var cl = (Class) sym;
 				if (cl.is_error_base) {
-					type = new ErrorType (null);
+					type = new ErrorType (null, unresolved_type.source_reference);
 				} else {
 					type = new ClassType (cl);
 				}
@@ -254,7 +254,7 @@
 			} else if (sym is Enum) {
 				type = new ValueType ((Enum) sym);
 			} else if (sym is ErrorDomain) {
-				type = new ErrorType ((ErrorDomain) sym);
+				type = new ErrorType ((ErrorDomain) sym, unresolved_type.source_reference);
 			} else {
 				Report.error (unresolved_type.source_reference, "internal error: `%s' is not a supported type".printf (sym.get_full_name ()));
 				return new InvalidType ();



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