[vala/staging: 2/4] vala: Add common Callable interface for Method, Delegate and Signal.



commit c68490abe583e68766c20ed41dbd0fb875a8dcdf
Author: Luca Bruno <lucabru src gnome org>
Date:   Mon Jan 10 10:31:19 2011 +0100

    vala: Add common Callable interface for Method, Delegate and Signal.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=639124

 vala/Makefile.am       |    1 +
 vala/valacallable.vala |   45 +++++++++++++++++++++++++++++++++++++++++++++
 vala/valadelegate.vala |    2 +-
 vala/valamethod.vala   |    2 +-
 vala/valasignal.vala   |    2 +-
 5 files changed, 49 insertions(+), 3 deletions(-)
---
diff --git a/vala/Makefile.am b/vala/Makefile.am
index bd16142..134d732 100644
--- a/vala/Makefile.am
+++ b/vala/Makefile.am
@@ -32,6 +32,7 @@ libvalacore_la_VALASOURCES = \
        valabooleanliteral.vala \
        valabooleantype.vala \
        valabreakstatement.vala \
+       valacallable.vala \
        valacastexpression.vala \
        valacatchclause.vala \
        valacharacterliteral.vala \
diff --git a/vala/valacallable.vala b/vala/valacallable.vala
new file mode 100644
index 0000000..5b29aa9
--- /dev/null
+++ b/vala/valacallable.vala
@@ -0,0 +1,45 @@
+/* valacallable.vala
+ *
+ * Copyright (C) 2011  Luca Bruno
+ *
+ * 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:
+ *     Luca Bruno <lucabru src gnome org>
+ */
+
+using GLib;
+
+/**
+ * Interface for all callable types.
+ */
+public interface Vala.Callable : CodeNode {
+       /**
+        * The return type of this callable.
+        */
+       public abstract DataType return_type { get; set; }
+
+       /**
+        * Appends parameter to this callable.
+        *
+        * @param param a formal parameter
+        */
+       public abstract void add_parameter (Parameter param);
+
+       /**
+        * Returns the parameter list.
+        */
+       public abstract List<Parameter> get_parameters ();
+}
diff --git a/vala/valadelegate.vala b/vala/valadelegate.vala
index 73af358..6f4ae3b 100644
--- a/vala/valadelegate.vala
+++ b/vala/valadelegate.vala
@@ -25,7 +25,7 @@ using GLib;
 /**
  * Represents a function callback type.
  */
-public class Vala.Delegate : TypeSymbol {
+public class Vala.Delegate : TypeSymbol, Callable {
        /**
         * The return type of this callback.
         */
diff --git a/vala/valamethod.vala b/vala/valamethod.vala
index 7c883b5..f0f1980 100644
--- a/vala/valamethod.vala
+++ b/vala/valamethod.vala
@@ -27,7 +27,7 @@ using GLib;
 /**
  * Represents a type or namespace method.
  */
-public class Vala.Method : Subroutine {
+public class Vala.Method : Subroutine, Callable {
        List<TypeParameter> type_parameters;
 
        /**
diff --git a/vala/valasignal.vala b/vala/valasignal.vala
index 6b05a09..17e858f 100644
--- a/vala/valasignal.vala
+++ b/vala/valasignal.vala
@@ -25,7 +25,7 @@ using GLib;
 /**
  * Represents an object signal. Signals enable objects to provide notifications.
  */
-public class Vala.Signal : Symbol, Lockable {
+public class Vala.Signal : Symbol, Lockable, Callable {
        /**
         * The return type of handlers of this signal.
         */


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