]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
Do not report errors for automatic interface properties twice
authorFlorian Brosch <flo.brosch@gmail.com>
Mon, 15 Sep 2014 20:01:20 +0000 (22:01 +0200)
committerLuca Bruno <lucabru@src.gnome.org>
Wed, 1 Oct 2014 20:19:10 +0000 (22:19 +0200)
vala/valainterface.vala
vala/valapropertyaccessor.vala

index 49bc0ae2cf2d1e79135e916cd8d20c8d7a187aca..92eee4e32203bedaf881730ec02a8118db85cb14 100644 (file)
@@ -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);
 
index 057e442079e339fbe5740b74b6e6df91d0ec1821..f29a04672d4d9dbffd752d34cb5d3aedb794bc7d 100644 (file)
@@ -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);