diff options
author | Florian Brosch <flo.brosch@gmail.com> | 2014-09-15 22:01:20 +0200 |
---|---|---|
committer | Luca Bruno <lucabru@src.gnome.org> | 2014-10-01 22:19:10 +0200 |
commit | c2827752d90551e6f192eb9f9c4114664a30057f (patch) | |
tree | e9cb0ad287c3b61d0486290c3654c2cc0a30e2e3 /vala | |
parent | 08254c8d82b0c9bc58716ccb5440461e4d806100 (diff) | |
download | vala-c2827752d90551e6f192eb9f9c4114664a30057f.tar.gz |
Do not report errors for automatic interface properties twice
Diffstat (limited to 'vala')
-rw-r--r-- | vala/valainterface.vala | 7 | ||||
-rw-r--r-- | vala/valapropertyaccessor.vala | 5 |
2 files changed, 7 insertions, 5 deletions
diff --git a/vala/valainterface.vala b/vala/valainterface.vala index 49bc0ae2c..92eee4e32 100644 --- a/vala/valainterface.vala +++ b/vala/valainterface.vala @@ -197,6 +197,13 @@ public class Vala.Interface : ObjectTypeSymbol { * @param prop a property */ public override void add_property (Property prop) { + if (prop.field != null) { + Report.error (prop.source_reference, "automatic properties are not allowed in interfaces"); + + prop.error = true; + return; + } + properties.add (prop); scope.add (prop.name, prop); diff --git a/vala/valapropertyaccessor.vala b/vala/valapropertyaccessor.vala index 057e44207..f29a04672 100644 --- a/vala/valapropertyaccessor.vala +++ b/vala/valapropertyaccessor.vala @@ -162,11 +162,6 @@ public class Vala.PropertyAccessor : Subroutine { if (body == null && !prop.interface_only && !prop.is_abstract) { /* no accessor body specified, insert default body */ - if (prop.parent_symbol is Interface) { - error = true; - Report.error (source_reference, "Automatic properties can't be used in interfaces"); - return false; - } automatic_body = true; body = new Block (source_reference); var ma = new MemberAccess.simple ("_%s".printf (prop.name), source_reference); |