vala r1036 - in trunk: . gobject tests vala
- From: rasa svn gnome org
- To: svn-commits-list gnome org
- Subject: vala r1036 - in trunk: . gobject tests vala
- Date: Sat, 23 Feb 2008 17:12:14 +0000 (GMT)
Author: rasa
Date: Sat Feb 23 17:12:14 2008
New Revision: 1036
URL: http://svn.gnome.org/viewvc/vala?rev=1036&view=rev
Log:
2008-02-23 Raffaele Sandrini <raffaele sandrini ch>
* gobject/valaccodegenerator.vala, vala/valaerrortype.vala: fix
handling of error type parameters in the gobject backend, fix
creation of GErrors outside of throws statements
* tests/exceptions.vala: test error cast
Modified:
trunk/ChangeLog
trunk/gobject/valaccodegenerator.vala
trunk/tests/exceptions.vala
trunk/vala/valaerrortype.vala
Modified: trunk/gobject/valaccodegenerator.vala
==============================================================================
--- trunk/gobject/valaccodegenerator.vala (original)
+++ trunk/gobject/valaccodegenerator.vala Sat Feb 23 17:12:14 2008
@@ -122,6 +122,7 @@
private bool requires_array_free;
private bool requires_array_move;
private bool requires_strcmp0;
+ private bool inside_throws_statement;
private Set<string> wrappers;
@@ -2056,7 +2057,9 @@
}
public override void visit_throw_statement (ThrowStatement! stmt) {
+ inside_throws_statement = true;
stmt.accept_children (this);
+ inside_throws_statement = false;
var cfrag = new CCodeFragment ();
@@ -2783,8 +2786,12 @@
var ecode = (ErrorCode) expr.symbol_reference;
var edomain = (ErrorDomain) ecode.parent_symbol;
- creation_call = new CCodeFunctionCall (new CCodeIdentifier ("g_set_error"));
- creation_call.add_argument (new CCodeIdentifier ("error"));
+ if (inside_throws_statement) {
+ creation_call = new CCodeFunctionCall (new CCodeIdentifier ("g_set_error"));
+ creation_call.add_argument (new CCodeIdentifier ("error"));
+ } else {
+ creation_call = new CCodeFunctionCall (new CCodeIdentifier ("g_error_new"));
+ }
creation_call.add_argument (new CCodeIdentifier (edomain.get_upper_case_cname ()));
creation_call.add_argument (new CCodeIdentifier (ecode.get_cname ()));
Modified: trunk/tests/exceptions.vala
==============================================================================
--- trunk/tests/exceptions.vala (original)
+++ trunk/tests/exceptions.vala Sat Feb 23 17:12:14 2008
@@ -41,6 +41,8 @@
return result;
}
+ public void error_cast_check (GLib.Error e) {}
+
public void run () {
stdout.printf (" 2");
@@ -80,6 +82,9 @@
stdout.printf (" 13");
}
+ // test implicit cast to GLib.Error
+ error_cast_check (new BarError.FOO ("FOO"));
+
stdout.printf (" 14");
}
Modified: trunk/vala/valaerrortype.vala
==============================================================================
--- trunk/vala/valaerrortype.vala (original)
+++ trunk/vala/valaerrortype.vala Sat Feb 23 17:12:14 2008
@@ -18,6 +18,7 @@
*
* Author:
* JÃrg Billeter <j bitron ch>
+ * Raffaele Sandrini <raffaele sandrini ch>
*/
using GLib;
@@ -64,4 +65,8 @@
public override DataType copy () {
return new ErrorType (error_domain);
}
+
+ public override string get_cname (bool var_type = false, bool const_type = false) {
+ return "GError*";
+ }
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]