]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
Remove Member class
authorJürg Billeter <j@bitron.ch>
Sun, 25 Jul 2010 09:27:35 +0000 (11:27 +0200)
committerJürg Billeter <j@bitron.ch>
Tue, 27 Jul 2010 13:31:42 +0000 (15:31 +0200)
13 files changed:
codegen/valaccodebasemodule.vala
codegen/valaccodemodule.vala
vala/Makefile.am
vala/valaconstant.vala
vala/valaenumvalue.vala
vala/valafield.vala
vala/valamember.vala [deleted file]
vala/valamethod.vala
vala/valanamespace.vala
vala/valaproperty.vala
vala/valasignal.vala
vala/valasymbol.vala
vala/valatypesymbol.vala

index 05f8e93f44ccaef0a1ae78d26f5da1931f83df20..4edeb1a88403037e2a18b98042cd445c702ff8c3 100644 (file)
@@ -733,7 +733,7 @@ public class Vala.CCodeBaseModule : CCodeModule {
                }
        }
 
-       public override void visit_member (Member m) {
+       public override void visit_member (Symbol m) {
                /* stuff meant for all lockable members */
                if (m is Lockable && ((Lockable) m).get_lock_used ()) {
                        CCodeExpression l = new CCodeIdentifier ("self");
@@ -3438,7 +3438,7 @@ public class Vala.CCodeBaseModule : CCodeModule {
        private CCodeExpression get_lock_expression (Statement stmt, Expression resource) {
                CCodeExpression l = null;
                var inner_node = ((MemberAccess)resource).inner;
-               var member = (Member)resource.symbol_reference;
+               var member = resource.symbol_reference;
                var parent = (TypeSymbol)resource.symbol_reference.parent_symbol;
                
                if (member.is_instance_member ()) {
index 1afeac224708547438c3d64a64d0b8312b77d22d..a7cb1120e6c35a7a0161298a38c50610ee72540d 100644 (file)
@@ -79,7 +79,7 @@ public abstract class Vala.CCodeModule {
                next.visit_delegate (d);
        }
        
-       public virtual void visit_member (Member m) {
+       public virtual void visit_member (Symbol m) {
                next.visit_member (m);
        }
 
index e0a5f38760f762cb272315553f8cfee99390fa83..1dc0ca857b5de9c8d5f9cace35f4198d741054e2 100644 (file)
@@ -94,7 +94,6 @@ libvalacore_la_VALASOURCES = \
        valaloop.vala \
        valamapliteral.vala \
        valamarkupreader.vala \
-       valamember.vala \
        valamemberaccess.vala \
        valamemberinitializer.vala \
        valamethod.vala \
index e889e40d64e9a48ff55f39a4b3dbbd9adbca0c47..416ab22c846c14d4d4a904b00701965a4fd287de 100644 (file)
@@ -25,7 +25,7 @@ using GLib;
 /**
  * Represents a type member with a constant value.
  */
-public class Vala.Constant : Member, Lockable {
+public class Vala.Constant : Symbol, Lockable {
        /**
         * The data type of this constant.
         */
index 47f11ee19792b54b76b98b2c204ad51e2d43ed3d..0c3d0ea07265f7ded0bae38f70719e8fc45311ad 100644 (file)
@@ -31,8 +31,6 @@ public class Vala.EnumValue : Symbol {
         */
        public Expression value { get; set; }
 
-       public Comment comment { get; set; }
-
        private string cname;
 
        /**
index 82e48f1f0569b164b239cbfff7af2378bf2f6b7b..85029d23b6b34cff930ba4a5d450ff0ecc7cd09b 100644 (file)
@@ -25,7 +25,7 @@ using GLib;
 /**
  * Represents a type or namespace field.
  */
-public class Vala.Field : Member, Lockable {
+public class Vala.Field : Symbol, Lockable {
        /**
         * The data type of this field.
         */
diff --git a/vala/valamember.vala b/vala/valamember.vala
deleted file mode 100644 (file)
index 1d2a259..0000000
+++ /dev/null
@@ -1,102 +0,0 @@
-/* valamember.vala
- *
- * Copyright (C) 2006-2008  Raffaele Sandrini, Jürg Billeter
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
-
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
-
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
- *
- * Author:
- *     Raffaele Sandrini <raffaele@sandrini.ch>
- */
-
-using GLib;
-
-/**
- * Represents a general class member.
- */
-public abstract class Vala.Member : Symbol {
-       public Comment comment { get; set; }
-
-       private List<string> cheader_filenames = new ArrayList<string> ();
-
-       /**
-        * Specifies whether this method explicitly hides a member of a base
-        * type.
-        */
-       public bool hides { get; set; }
-
-       public Member (string? name, SourceReference? source_reference, Comment? comment = null) {
-               base (name, source_reference);
-               this.comment = comment;
-       }
-
-       public override List<string> get_cheader_filenames () {
-               if (cheader_filenames.size == 0 && parent_symbol != null) {
-                       /* default to header filenames of the namespace */
-                       foreach (string filename in parent_symbol.get_cheader_filenames ()) {
-                               add_cheader_filename (filename);
-                       }
-
-                       if (cheader_filenames.size == 0 && source_reference != null && !external_package) {
-                               // don't add default include directives for VAPI files
-                               cheader_filenames.add (source_reference.file.get_cinclude_filename ());
-                       }
-               }
-               return cheader_filenames;
-       }
-
-       
-       /**
-        * Adds a filename to the list of C header filenames users of this data
-        * type must include.
-        *
-        * @param filename a C header filename
-        */
-       public void add_cheader_filename (string filename) {
-               cheader_filenames.add (filename);
-       }
-
-       public Symbol? get_hidden_member () {
-               Symbol sym = null;
-
-               if (parent_symbol is Class) {
-                       var cl = ((Class) parent_symbol).base_class;
-                       while (cl != null) {
-                               sym = cl.scope.lookup (name);
-                               if (sym != null && sym.access != SymbolAccessibility.PRIVATE) {
-                                       return sym;
-                               }
-                               cl = cl.base_class;
-                       }
-               } else if (parent_symbol is Struct) {
-                       var st = ((Struct) parent_symbol).base_struct;
-                       while (st != null) {
-                               sym = st.scope.lookup (name);
-                               if (sym != null && sym.access != SymbolAccessibility.PRIVATE) {
-                                       return sym;
-                               }
-                               st = st.base_struct;
-                       }
-               }
-
-               return null;
-       }
-}
-
-public enum MemberBinding {
-       INSTANCE,
-       CLASS,
-       STATIC
-}
-
index 0319868acd816afe4f2502c09f011e2efc252952..8b361066db26ae375d14b2b6df44c8b3378db44e 100644 (file)
@@ -27,7 +27,7 @@ using GLib;
 /**
  * Represents a type or namespace method.
  */
-public class Vala.Method : Member {
+public class Vala.Method : Symbol {
        List<TypeParameter> type_parameters = new ArrayList<TypeParameter> ();
 
        public const string DEFAULT_SENTINEL = "NULL";
index 1417f1006611b8cff330a9eb822f3f23f4b03e08..e7b51095885c2373bbbd805123fd8f5235d8c3b6 100644 (file)
@@ -41,8 +41,6 @@ public class Vala.Namespace : Symbol {
        private List<string> cprefixes = new ArrayList<string> ();
        private string lower_case_cprefix;
        
-       private List<string> cheader_filenames = new ArrayList<string> ();
-
        private List<Namespace> namespaces = new ArrayList<Namespace> ();
 
        private List<UsingDirective> using_directives = new ArrayList<UsingDirective> ();
@@ -517,30 +515,6 @@ public class Vala.Namespace : Symbol {
                this.lower_case_cprefix = cprefix;
        }
 
-       public override List<string> get_cheader_filenames () {
-               return cheader_filenames;
-       }
-
-       /**
-        * Sets the C header filename of this namespace to the specified
-        * filename.
-        *
-        * @param cheader_filename header filename
-        */
-       public void set_cheader_filename (string cheader_filename) {
-               cheader_filenames = new ArrayList<string> ();
-               cheader_filenames.add (cheader_filename);
-       }
-       
-       /**
-        * Adds a C header filename of this namespace.
-        *
-        * @param cheader_filename header filename
-        */
-       public void add_cheader_filename (string cheader_filename) {
-               cheader_filenames.add (cheader_filename);
-       }
-
        private void process_ccode_attribute (Attribute a) {
                if (a.has_argument ("cprefix")) {
                        string value = a.get_string ("cprefix");
@@ -559,7 +533,7 @@ public class Vala.Namespace : Symbol {
                if (a.has_argument ("cheader_filename")) {
                        var val = a.get_string ("cheader_filename");
                        foreach (string filename in val.split (",")) {
-                               cheader_filenames.add (filename);
+                               add_cheader_filename (filename);
                        }
                }
                if (a.has_argument ("gir_namespace")) {
index 3cb8afa727ae5c8a82f32c33788b0aeafa2fa97f..4f31ae28417c867376d487a6de09684f871c300f 100644 (file)
@@ -26,7 +26,7 @@ using GLib;
 /**
  * Represents a property declaration in the source code.
  */
-public class Vala.Property : Member, Lockable {
+public class Vala.Property : Symbol, Lockable {
        /**
         * The property type.
         */
index 443f4b45ae53f12b02def8e867dbec28f239c608..87d2efe29913c45a614a7609c3d63cebafc937ca 100644 (file)
@@ -25,7 +25,7 @@ using GLib;
 /**
  * Represents an object signal. Signals enable objects to provide notifications.
  */
-public class Vala.Signal : Member, Lockable {
+public class Vala.Signal : Symbol, Lockable {
        /**
         * The return type of handlers of this signal.
         */
index 8cb6e434861ab2a867b6f2221408f1770c39e73b..2fb6c3a9bb93771a04ef3cea2d8ff925a77482fa 100644 (file)
@@ -95,6 +95,16 @@ public abstract class Vala.Symbol : CodeNode {
         */
        public SymbolAccessibility access { get; set; }
 
+       public Comment? comment { get; set; }
+
+       private List<string> cheader_filenames = new ArrayList<string> ();
+
+       /**
+        * Specifies whether this method explicitly hides a member of a base
+        * type.
+        */
+       public bool hides { get; set; }
+
        /**
         * Check if this symbol is just internal API (and therefore doesn't need 
         * to be listed in header files for instance) by traversing parent symbols
@@ -153,9 +163,10 @@ public abstract class Vala.Symbol : CodeNode {
        private weak Scope _owner;
        private Scope _scope;
 
-       public Symbol (string? name, SourceReference? source_reference) {
+       public Symbol (string? name, SourceReference? source_reference, Comment? comment = null) {
                this.name = name;
                this.source_reference = source_reference;
+               this.comment = comment;
                _scope = new Scope (this);
        }
        
@@ -229,7 +240,19 @@ public abstract class Vala.Symbol : CodeNode {
         * @return list of C header filenames for this symbol
         */
        public virtual List<string> get_cheader_filenames () {
-               return new ArrayList<string> ();
+               // parent_symbol can be null on incremental parsing
+               if (cheader_filenames.size == 0 && parent_symbol != null) {
+                       /* default to header filenames of the namespace */
+                       foreach (string filename in parent_symbol.get_cheader_filenames ()) {
+                               add_cheader_filename (filename);
+                       }
+
+                       if (cheader_filenames.size == 0 && source_reference != null && !external_package) {
+                               // don't add default include directives for VAPI files
+                               cheader_filenames.add (source_reference.file.get_cinclude_filename ());
+                       }
+               }
+               return cheader_filenames;
        }
 
        /**
@@ -413,6 +436,53 @@ public abstract class Vala.Symbol : CodeNode {
                        return false;
                }
        }
+
+       /**
+        * Sets the C header filename of this namespace to the specified
+        * filename.
+        *
+        * @param cheader_filename header filename
+        */
+       public void set_cheader_filename (string cheader_filename) {
+               cheader_filenames = new ArrayList<string> ();
+               cheader_filenames.add (cheader_filename);
+       }
+
+       /**
+        * Adds a filename to the list of C header filenames users of this data
+        * type must include.
+        *
+        * @param filename a C header filename
+        */
+       public void add_cheader_filename (string filename) {
+               cheader_filenames.add (filename);
+       }
+
+       public Symbol? get_hidden_member () {
+               Symbol sym = null;
+
+               if (parent_symbol is Class) {
+                       var cl = ((Class) parent_symbol).base_class;
+                       while (cl != null) {
+                               sym = cl.scope.lookup (name);
+                               if (sym != null && sym.access != SymbolAccessibility.PRIVATE) {
+                                       return sym;
+                               }
+                               cl = cl.base_class;
+                       }
+               } else if (parent_symbol is Struct) {
+                       var st = ((Struct) parent_symbol).base_struct;
+                       while (st != null) {
+                               sym = st.scope.lookup (name);
+                               if (sym != null && sym.access != SymbolAccessibility.PRIVATE) {
+                                       return sym;
+                               }
+                               st = st.base_struct;
+                       }
+               }
+
+               return null;
+       }
 }
 
 public enum Vala.SymbolAccessibility {
@@ -422,3 +492,8 @@ public enum Vala.SymbolAccessibility {
        PUBLIC
 }
 
+public enum MemberBinding {
+       INSTANCE,
+       CLASS,
+       STATIC
+}
index 996e5dcc87eb61eae34b206e470f55447abe30f9..956939b8ef77eb5234099d58dbff05801b2086a4 100644 (file)
@@ -29,13 +29,8 @@ using GLib;
  * code or imported from an external library with a Vala API file.
  */
 public abstract class Vala.TypeSymbol : Symbol {
-       public Comment? comment { get; set; }
-
-       private List<string> cheader_filenames = new ArrayList<string> ();
-
        public TypeSymbol (string? name, SourceReference? source_reference = null, Comment? comment = null) {
-               base (name, source_reference);
-               this.comment = comment;
+               base (name, source_reference, comment);
        }
 
        /**
@@ -227,32 +222,6 @@ public abstract class Vala.TypeSymbol : Symbol {
                return null;
        }
 
-       public override List<string> get_cheader_filenames () {
-               // parent_symbol can be null on incremental parsing
-               if (cheader_filenames.size == 0 && parent_symbol != null) {
-                       /* default to header filenames of the namespace */
-                       foreach (string filename in parent_symbol.get_cheader_filenames ()) {
-                               add_cheader_filename (filename);
-                       }
-
-                       if (cheader_filenames.size == 0 && source_reference != null && !external_package) {
-                               // don't add default include directives for VAPI files
-                               cheader_filenames.add (source_reference.file.get_cinclude_filename ());
-                       }
-               }
-               return cheader_filenames;
-       }
-
-       /**
-        * Adds a filename to the list of C header filenames users of this data
-        * type must include.
-        *
-        * @param filename a C header filename
-        */
-       public void add_cheader_filename (string filename) {
-               cheader_filenames.add (filename);
-       }
-
        /**
         * Checks whether this data type is equal to or a subtype of the
         * specified data type.