[vala] Do not report errors for automatic interface properties twice



commit c2827752d90551e6f192eb9f9c4114664a30057f
Author: Florian Brosch <flo brosch gmail com>
Date:   Mon Sep 15 22:01:20 2014 +0200

    Do not report errors for automatic interface properties twice

 vala/valainterface.vala        |    7 +++++++
 vala/valapropertyaccessor.vala |    5 -----
 2 files changed, 7 insertions(+), 5 deletions(-)
---
diff --git a/vala/valainterface.vala b/vala/valainterface.vala
index 49bc0ae..92eee4e 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 057e442..f29a046 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);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]