Line data Source code
1 : /* valatypesymbol.vala
2 : *
3 : * Copyright (C) 2006-2010 Jürg Billeter
4 : * Copyright (C) 2006-2008 Raffaele Sandrini
5 : *
6 : * This library is free software; you can redistribute it and/or
7 : * modify it under the terms of the GNU Lesser General Public
8 : * License as published by the Free Software Foundation; either
9 : * version 2.1 of the License, or (at your option) any later version.
10 :
11 : * This library is distributed in the hope that it will be useful,
12 : * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 : * Lesser General Public License for more details.
15 :
16 : * You should have received a copy of the GNU Lesser General Public
17 : * License along with this library; if not, write to the Free Software
18 : * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 : *
20 : * Author:
21 : * Jürg Billeter <j@bitron.ch>
22 : * Raffaele Sandrini <raffaele@sandrini.ch>
23 : */
24 :
25 : using GLib;
26 :
27 : /**
28 : * Represents a runtime data type. This data type may be defined in Vala source
29 : * code or imported from an external library with a Vala API file.
30 : */
31 1538 : public abstract class Vala.TypeSymbol : Symbol {
32 1583762 : protected TypeSymbol (string? name, SourceReference? source_reference = null, Comment? comment = null) {
33 1583762 : base (name, source_reference, comment);
34 : }
35 :
36 : /**
37 : * Checks whether this data type has value or reference type semantics.
38 : *
39 : * @return true if this data type has reference type semantics
40 : */
41 321979 : public virtual bool is_reference_type () {
42 168763 : return false;
43 : }
44 :
45 : /**
46 : * Checks whether this data type is equal to or a subtype of the
47 : * specified data type.
48 : *
49 : * @param t a data type
50 : * @return true if t is a supertype of this data type, false otherwise
51 : */
52 8718439 : public virtual bool is_subtype_of (TypeSymbol t) {
53 190068 : return (this == t);
54 : }
55 :
56 : /**
57 : * Return the index of the specified type parameter name.
58 : */
59 129397 : public virtual int get_type_parameter_index (string name) {
60 : return -1;
61 : }
62 : }
|