var props = cl.get_properties ();
foreach (Property prop in props) {
if (!is_gobject_property (prop)) {
+ if (!has_valid_gobject_property_type (prop)) {
+ Report.warning (prop.source_reference, "Type `%s' can not be used for a GLib.Object property".printf (prop.property_type.to_qualified_string ()));
+ }
continue;
}
return false;
}
- var st = prop.property_type.data_type as Struct;
- if (st != null && (!get_ccode_has_type_id (st) || prop.property_type.nullable)) {
- return false;
- }
-
- if (prop.property_type is ArrayType && ((ArrayType)prop.property_type).element_type.data_type != string_type.data_type) {
- return false;
- }
-
- var d = prop.property_type as DelegateType;
- if (d != null && d.delegate_symbol.has_target) {
+ if (!has_valid_gobject_property_type (prop)) {
return false;
}
return true;
}
+ bool has_valid_gobject_property_type (Property prop) {
+ var st = prop.property_type.data_type as Struct;
+ if (st != null && (!get_ccode_has_type_id (st) || prop.property_type.nullable)) {
+ return false;
+ }
+
+ if (prop.property_type is ArrayType && ((ArrayType)prop.property_type).element_type.data_type != string_type.data_type) {
+ return false;
+ }
+
+ var d = prop.property_type as DelegateType;
+ if (d != null && d.delegate_symbol.has_target) {
+ return false;
+ }
+
+ return true;
+ }
+
public override void visit_method_call (MethodCall expr) {
if (expr.call is MemberAccess) {
push_line (expr.source_reference);
-[SimpleType]
-[CCode (has_type_id = false)]
-struct Minim {
- int a;
-}
-
struct Manam {
int a;
}
class BaseFoo : Object {
public virtual Manam st { get; set; }
- public virtual Minim sst { get; set; }
}
class Foo : Object {
public virtual Manam st { get; set; }
- public virtual Minim sst { get; set; }
}
class Bar : Foo {
get { return base.st; }
set { base.st = value; }
}
- public override Minim sst {
- get { return base.sst; }
- set { base.sst = value; }
- }
}
class Baz : BaseFoo {
get { return base.st; }
set { base.st = value; }
}
- public override Minim sst {
- get { return base.sst; }
- set { base.sst = value; }
- }
}
void main () {
var bar = new Bar ();
bar.st = { 42 };
- bar.sst = { 42 };
assert (bar.st.a == 42);
- assert (bar.sst.a == 42);
var baz = new Baz ();
baz.st = { 23 };
- baz.sst = { 23 };
assert (baz.st.a == 23);
- assert (baz.sst.a == 23);
}