vala r2208 - in trunk: . gobject
- From: juergbi svn gnome org
- To: svn-commits-list gnome org
- Subject: vala r2208 - in trunk: . gobject
- Date: Wed, 17 Dec 2008 23:33:05 +0000 (UTC)
Author: juergbi
Date: Wed Dec 17 23:33:05 2008
New Revision: 2208
URL: http://svn.gnome.org/viewvc/vala?rev=2208&view=rev
Log:
2008-12-18 JÃrg Billeter <j bitron ch>
* gobject/valaccodebasemodule.vala:
* gobject/valaccodemethodmodule.vala:
Remove statements without effect, fixes bug 530601
Modified:
trunk/ChangeLog
trunk/gobject/valaccodebasemodule.vala
trunk/gobject/valaccodemethodmodule.vala
Modified: trunk/gobject/valaccodebasemodule.vala
==============================================================================
--- trunk/gobject/valaccodebasemodule.vala (original)
+++ trunk/gobject/valaccodebasemodule.vala Wed Dec 17 23:33:05 2008
@@ -1254,10 +1254,14 @@
}
if (prop.binding == MemberBinding.INSTANCE && !is_virtual) {
+ CCodeStatement check_stmt;
if (returns_real_struct) {
- function.block.prepend_statement (create_property_type_check_statement (prop, false, t, true, "self"));
+ check_stmt = create_property_type_check_statement (prop, false, t, true, "self");
} else {
- function.block.prepend_statement (create_property_type_check_statement (prop, acc.readable, t, true, "self"));
+ check_stmt = create_property_type_check_statement (prop, acc.readable, t, true, "self");
+ }
+ if (check_stmt != null) {
+ function.block.prepend_statement (check_stmt);
}
}
@@ -3467,7 +3471,7 @@
return null;
}
- private CCodeStatement create_property_type_check_statement (Property prop, bool check_return_type, TypeSymbol t, bool non_null, string var_name) {
+ private CCodeStatement? create_property_type_check_statement (Property prop, bool check_return_type, TypeSymbol t, bool non_null, string var_name) {
if (check_return_type) {
return create_type_check_statement (prop, prop.property_type, t, non_null, var_name);
} else {
@@ -3506,7 +3510,7 @@
if (cdefault != null) {
ccheck.add_argument (cdefault);
} else {
- return new CCodeExpressionStatement (new CCodeConstant ("0"));
+ return null;
}
}
Modified: trunk/gobject/valaccodemethodmodule.vala
==============================================================================
--- trunk/gobject/valaccodemethodmodule.vala (original)
+++ trunk/gobject/valaccodemethodmodule.vala Wed Dec 17 23:33:05 2008
@@ -271,8 +271,10 @@
} else if (m.binding == MemberBinding.INSTANCE
&& !(m is CreationMethod)) {
var ccheckstmt = create_method_type_check_statement (m, creturn_type, cl, true, "self");
- ccheckstmt.line = function.line;
- cinit.append (ccheckstmt);
+ if (ccheckstmt != null) {
+ ccheckstmt.line = function.line;
+ cinit.append (ccheckstmt);
+ }
}
}
foreach (FormalParameter param in m.get_parameters ()) {
@@ -411,7 +413,10 @@
}
foreach (Expression precondition in m.get_preconditions ()) {
- cinit.append (create_precondition_statement (m, creturn_type, precondition));
+ var check_stmt = create_precondition_statement (m, creturn_type, precondition);
+ if (check_stmt != null) {
+ cinit.append (check_stmt);
+ }
}
} else if (m.is_abstract) {
// generate helpful error message if a sublcass does not implement an abstract method.
@@ -421,7 +426,10 @@
var cblock = new CCodeBlock ();
// add a typecheck statement for "self"
- cblock.add_statement (create_method_type_check_statement (m, creturn_type, current_type_symbol, true, "self"));
+ var check_stmt = create_method_type_check_statement (m, creturn_type, current_type_symbol, true, "self");
+ if (check_stmt != null) {
+ cblock.add_statement (check_stmt);
+ }
// add critical warning that this method should not have been called
var type_from_instance_call = new CCodeFunctionCall (new CCodeIdentifier ("G_TYPE_FROM_INSTANCE"));
@@ -679,7 +687,10 @@
var vblock = new CCodeBlock ();
foreach (Expression precondition in m.get_preconditions ()) {
- vblock.add_statement (create_precondition_statement (m, return_type, precondition));
+ var check_stmt = create_precondition_statement (m, return_type, precondition);
+ if (check_stmt != null) {
+ vblock.add_statement (check_stmt);
+ }
}
CCodeFunctionCall vcast = null;
@@ -741,11 +752,11 @@
source_type_member_definition.append (vfunc);
}
- private CCodeStatement create_method_type_check_statement (Method m, DataType return_type, TypeSymbol t, bool non_null, string var_name) {
+ private CCodeStatement? create_method_type_check_statement (Method m, DataType return_type, TypeSymbol t, bool non_null, string var_name) {
return create_type_check_statement (m, return_type, t, non_null, var_name);
}
- private CCodeStatement create_precondition_statement (CodeNode method_node, DataType ret_type, Expression precondition) {
+ private CCodeStatement? create_precondition_statement (CodeNode method_node, DataType ret_type, Expression precondition) {
var ccheck = new CCodeFunctionCall ();
ccheck.add_argument ((CCodeExpression) precondition.ccodenode);
@@ -760,7 +771,7 @@
if (cdefault != null) {
ccheck.add_argument (cdefault);
} else {
- return new CCodeExpressionStatement (new CCodeConstant ("0"));
+ return null;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]