gio-unix-2.0: Add DesktopAppInfo.launch_uris_as_manager_with_fds()
[vala-gnome.git] / vala / valamethodtype.vala
bloba2effdec643fd0508af2bd6bf23d9ae5df9cf9b0
1 /* valamethodtype.vala
3 * Copyright (C) 2007-2008 Jürg Billeter
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 * Author:
20 * Jürg Billeter <j@bitron.ch>
23 using GLib;
25 /**
26 * The type of a method referencea.
28 public class Vala.MethodType : CallableType {
29 public weak Method method_symbol { get; set; }
31 public MethodType (Method method_symbol) {
32 this.method_symbol = method_symbol;
35 public override bool is_invokable () {
36 return true;
39 public override DataType? get_return_type () {
40 return method_symbol.return_type;
43 public override List<Parameter>? get_parameters () {
44 return method_symbol.get_parameters ();
47 public override DataType copy () {
48 return new MethodType (method_symbol);
51 public override bool compatible (DataType target_type) {
52 var dt = target_type as DelegateType;
53 if (dt == null) {
54 // method types incompatible to anything but delegates
55 return false;
58 return dt.delegate_symbol.matches_method (method_symbol, dt);
61 public override string to_qualified_string (Scope? scope) {
62 return method_symbol.get_full_name ();
65 public override Symbol? get_member (string member_name) {
66 if (method_symbol.coroutine && member_name == "begin") {
67 return method_symbol;
68 } else if (method_symbol.coroutine && member_name == "end") {
69 return method_symbol;
70 } else if (method_symbol.coroutine && member_name == "callback") {
71 return method_symbol.get_callback_method ();
73 return null;