1 /* valadelegatetype.vala
3 * Copyright (C) 2007-2009 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
20 * Jürg Billeter <j@bitron.ch>
26 * The type of an instance of a delegate.
28 public class Vala
.DelegateType
: DataType
{
29 public Delegate delegate_symbol
{ get; set; }
31 public DelegateType (Delegate delegate_symbol
) {
32 this
.delegate_symbol
= delegate_symbol
;
35 public override bool is_invokable () {
39 public override DataType?
get_return_type () {
40 return delegate_symbol
.return_type
;
43 public override List
<FormalParameter
>?
get_parameters () {
44 return delegate_symbol
.get_parameters ();
47 public override string to_qualified_string (Scope? scope
) {
48 string s
= delegate_symbol
.get_full_name ();
55 public override DataType
copy () {
56 var result
= new
DelegateType (delegate_symbol
);
57 result
.source_reference
= source_reference
;
58 result
.value_owned
= value_owned
;
59 result
.nullable
= nullable
;
61 foreach (DataType arg
in get_type_arguments ()) {
62 result
.add_type_argument (arg
.copy ());
68 public override string?
get_cname () {
69 return delegate_symbol
.get_cname ();
72 public override List
<Symbol
> get_symbols () {
73 var symbols
= new ArrayList
<Symbol
> ();
74 symbols
.add (delegate_symbol
);
78 public override string?
get_type_id () {
79 return "G_TYPE_POINTER";
82 public override bool check (SemanticAnalyzer analyzer
) {
83 return delegate_symbol
.check (analyzer
);
86 public override bool is_disposable () {
87 return delegate_symbol
.has_target
&& value_owned
;