]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
GType: Do not allow 'type' properties
authorLuca Bruno <lethalman88@gmail.com>
Sat, 20 Mar 2010 13:47:51 +0000 (14:47 +0100)
committerJürg Billeter <j@bitron.ch>
Sat, 20 Mar 2010 13:47:51 +0000 (14:47 +0100)
Generated get_type function would cause conflicts.

Fixes bug 586817.

codegen/valagtypemodule.vala

index a919e5128d23a9028fe17a2e20b197d62094928d..c99a38199ed6a98d555066347a2df575af78c0be 100644 (file)
@@ -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);
+       }
 }