From c68490abe583e68766c20ed41dbd0fb875a8dcdf Mon Sep 17 00:00:00 2001 From: Luca Bruno Date: Mon, 10 Jan 2011 10:31:19 +0100 Subject: [PATCH] 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(-) create mode 100644 vala/valacallable.vala diff --git a/vala/Makefile.am b/vala/Makefile.am index bd16142d7..134d732aa 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 000000000..5b29aa9ff --- /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 + */ + +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 get_parameters (); +} diff --git a/vala/valadelegate.vala b/vala/valadelegate.vala index 73af358fc..6f4ae3b7c 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 7c883b5cd..f0f19809f 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 type_parameters; /** diff --git a/vala/valasignal.vala b/vala/valasignal.vala index 6b05a0926..17e858fd1 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. */ -- 2.47.2