Warn when using result variable with incompatible type to prepare possible
[vala-lang.git] / vala / valadelegatetype.vala
blob40035d9f79c6ec3a5ae402158eb3ec66ea8c57e5
1 /* valadelegatetype.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;
24 using Gee;
26 /**
27 * The type of an instance of a delegate.
29 public class Vala.DelegateType : DataType {
30 public Delegate delegate_symbol { get; set; }
32 public DelegateType (Delegate delegate_symbol) {
33 this.delegate_symbol = delegate_symbol;
36 public override bool is_invokable () {
37 return true;
40 public override DataType? get_return_type () {
41 return delegate_symbol.return_type;
44 public override Gee.List<FormalParameter>? get_parameters () {
45 return delegate_symbol.get_parameters ();
48 public override string to_qualified_string (Scope? scope) {
49 string s = delegate_symbol.get_full_name ();
50 if (nullable) {
51 s += "?";
53 return s;
56 public override DataType copy () {
57 return new DelegateType (delegate_symbol);
60 public override string? get_cname () {
61 return delegate_symbol.get_cname ();
64 public override Gee.List<Symbol> get_symbols () {
65 var symbols = new ArrayList<Symbol> ();
66 symbols.add (delegate_symbol);
67 return symbols;
70 public override string? get_type_id () {
71 return "G_TYPE_POINTER";
74 public override bool check (SemanticAnalyzer analyzer) {
75 return delegate_symbol.check (analyzer);