From: Luca Bruno Date: Sat, 20 Mar 2010 13:47:51 +0000 (+0100) Subject: GType: Do not allow 'type' properties X-Git-Tag: 0.8.0~149 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=fef9c6e66082171433eabc97ca25ac181679c6c1;p=thirdparty%2Fvala.git GType: Do not allow 'type' properties Generated get_type function would cause conflicts. Fixes bug 586817. --- diff --git a/codegen/valagtypemodule.vala b/codegen/valagtypemodule.vala index a919e5128..c99a38199 100644 --- a/codegen/valagtypemodule.vala +++ b/codegen/valagtypemodule.vala @@ -1949,4 +1949,14 @@ internal class Vala.GTypeModule : GErrorModule { ccomma.append_expression (new CCodeConditionalExpression (is_null_value, new CCodeMemberAccess.pointer (get_variable_cexpression (temp_var.name), "value_name"), new CCodeIdentifier ("NULL"))); expr.ccodenode = ccomma; } + + public override void visit_property (Property prop) { + var cl = current_type_symbol as Class; + var st = current_type_symbol as Struct; + if (prop.name == "type" && ((cl != null && !cl.is_compact) || (st != null && st.has_type_id))) { + Report.error (prop.source_reference, "Property 'type' not allowed"); + return; + } + base.visit_property (prop); + } }