]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
vala: Move constant lists from Class/Interface up to ObjectTypeSymbol
authorRico Tzschichholz <ricotz@ubuntu.com>
Wed, 17 Jan 2018 09:26:10 +0000 (10:26 +0100)
committerRico Tzschichholz <ricotz@ubuntu.com>
Wed, 17 Jan 2018 10:06:46 +0000 (11:06 +0100)
vala/valaclass.vala
vala/valainterface.vala
vala/valaobjecttypesymbol.vala

index c76cf558400684f35bf6914b2f777bacd376bbcf..f61bb350ef942e7ed49ede1ca971e5f458bde8cc 100644 (file)
@@ -100,8 +100,6 @@ public class Vala.Class : ObjectTypeSymbol {
 
        private List<DataType> base_types = new ArrayList<DataType> ();
 
-       private List<Constant> constants = new ArrayList<Constant> ();
-
        /**
         * Specifies the default construction method.
         */
@@ -192,16 +190,6 @@ public class Vala.Class : ObjectTypeSymbol {
                return base_types;
        }
 
-       /**
-        * Adds the specified constant as a member to this class.
-        *
-        * @param c a constant
-        */
-       public override void add_constant (Constant c) {
-               constants.add (c);
-               scope.add (c.name, c);
-       }
-       
        /**
         * Adds the specified field as a member to this class.
         *
@@ -217,15 +205,6 @@ public class Vala.Class : ObjectTypeSymbol {
                }
        }
        
-       /**
-        * Returns a copy of the list of constants.
-        *
-        * @return list of constants
-        */
-       public List<Constant> get_constants () {
-               return constants;
-       }
-
        /**
         * Adds the specified method as a member to this class.
         *
@@ -345,7 +324,7 @@ public class Vala.Class : ObjectTypeSymbol {
                        f.accept (visitor);
                }
                
-               foreach (Constant c in constants) {
+               foreach (Constant c in get_constants ()) {
                        c.accept (visitor);
                }
                
@@ -531,7 +510,7 @@ public class Vala.Class : ObjectTypeSymbol {
                        f.check (context);
                }
                
-               foreach (Constant c in constants) {
+               foreach (Constant c in get_constants ()) {
                        c.check (context);
                }
                
index c12a6ce90c1b2eeb911f9e8fa2438315435e44b8..8e3229c9450c94245ecd048269711dbb81c29eab 100644 (file)
@@ -28,7 +28,6 @@ using GLib;
 public class Vala.Interface : ObjectTypeSymbol {
        private List<DataType> prerequisites = new ArrayList<DataType> ();
 
-       private List<Constant> constants = new ArrayList<Constant> ();
        private List<Symbol> virtuals = new ArrayList<Symbol> ();
 
        /**
@@ -96,25 +95,6 @@ public class Vala.Interface : ObjectTypeSymbol {
                base.add_method (m);
        }
 
-       /**
-        * Adds the specified constant as a member to this interface.
-        *
-        * @param c a constant
-        */
-       public override void add_constant (Constant c) {
-               constants.add (c);
-               scope.add (c.name, c);
-       }
-
-       /**
-        * Returns a copy of the list of constants.
-        *
-        * @return list of constants
-        */
-       public List<Constant> get_constants () {
-               return constants;
-       }
-
        /**
         * Adds the specified property as a member to this interface.
         *
@@ -164,7 +144,7 @@ public class Vala.Interface : ObjectTypeSymbol {
                        f.accept (visitor);
                }
 
-               foreach (Constant c in constants) {
+               foreach (Constant c in get_constants ()) {
                        c.accept (visitor);
                }
 
@@ -292,7 +272,7 @@ public class Vala.Interface : ObjectTypeSymbol {
                        f.check (context);
                }
 
-               foreach (Constant c in constants) {
+               foreach (Constant c in get_constants ()) {
                        c.check (context);
                }
 
index ab90322c46444dddaffc2cc51e092d8cc04cc400..aca53ed006578414d221631c743676acd0bb1774 100644 (file)
@@ -45,6 +45,8 @@ public abstract class Vala.ObjectTypeSymbol : TypeSymbol {
        private List<Enum> enums = new ArrayList<Enum> ();
        private List<Delegate> delegates = new ArrayList<Delegate> ();
 
+       private List<Constant> constants = new ArrayList<Constant> ();
+
        public ObjectTypeSymbol (string name, SourceReference? source_reference = null, Comment? comment = null) {
                base (name, source_reference, comment);
        }
@@ -214,6 +216,25 @@ public abstract class Vala.ObjectTypeSymbol : TypeSymbol {
                scope.add (d.name, d);
        }
 
+       /**
+        * Adds the specified constant as a member to this interface.
+        *
+        * @param c a constant
+        */
+       public override void add_constant (Constant c) {
+               constants.add (c);
+               scope.add (c.name, c);
+       }
+
+       /**
+        * Returns the list of constants.
+        *
+        * @return list of constants
+        */
+       public List<Constant> get_constants () {
+               return constants;
+       }
+
        /**
         * Appends the specified parameter to the list of type parameters.
         *