2008-04-26 Jürg Billeter <j@bitron.ch>
+ * vala/valacatchclause.vala:
+ * gobject/valaccodegenerator.vala:
+
+ Support catch clauses without error variable, fixes bug 529539
+
+2008-04-26 Jürg Billeter <j@bitron.ch>
+
* vala/valanamespace.vala:
* vala/valaparser.vala:
var cblock = new CCodeBlock ();
+ string variable_name = clause.variable_name;
+ if (variable_name == null) {
+ variable_name = "__err";
+ }
+
var cdecl = new CCodeDeclaration ("GError *");
- cdecl.add_declarator (new CCodeVariableDeclarator.with_initializer (clause.variable_name, new CCodeIdentifier ("inner_error")));
+ cdecl.add_declarator (new CCodeVariableDeclarator.with_initializer (variable_name, new CCodeIdentifier ("inner_error")));
cblock.add_statement (cdecl);
cblock.add_statement (new CCodeExpressionStatement (new CCodeAssignment (new CCodeIdentifier ("inner_error"), new CCodeConstant ("NULL"))));
/**
* Specifies the error variable name.
*/
- public string variable_name { get; set; }
+ public string? variable_name { get; set; }
/**
* Specifies the error handler body.
* @param source_reference reference to source code
* @return newly created catch clause
*/
- public CatchClause (DataType? error_type, string variable_name, Block body, SourceReference? source_reference = null) {
+ public CatchClause (DataType? error_type, string? variable_name, Block body, SourceReference? source_reference = null) {
this.error_type = error_type;
this.variable_name = variable_name;
this.body = body;