[vala] GType: Do not allow 'type' properties
- From: Jürg Billeter <juergbi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala] GType: Do not allow 'type' properties
- Date: Sat, 20 Mar 2010 13:49:22 +0000 (UTC)
commit fef9c6e66082171433eabc97ca25ac181679c6c1
Author: Luca Bruno <lethalman88 gmail com>
Date: Sat Mar 20 14:47:51 2010 +0100
GType: Do not allow 'type' properties
Generated get_type function would cause conflicts.
Fixes bug 586817.
codegen/valagtypemodule.vala | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
---
diff --git a/codegen/valagtypemodule.vala b/codegen/valagtypemodule.vala
index a919e51..c99a381 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);
+ }
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]