Line data Source code
1 : /* valavariable.vala
2 : *
3 : * Copyright (C) 2010 Jürg Billeter
4 : *
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.
9 :
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.
14 :
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
18 : *
19 : * Author:
20 : * Jürg Billeter <j@bitron.ch>
21 : */
22 :
23 16219745 : public abstract class Vala.Variable : Symbol {
24 : /**
25 : * The optional initializer expression.
26 : */
27 : public Expression? initializer {
28 63068674 : get {
29 63068674 : return _initializer;
30 : }
31 17313743 : set {
32 41736547 : _initializer = value;
33 17313743 : if (_initializer != null) {
34 1190562 : _initializer.parent_node = this;
35 : }
36 : }
37 : }
38 :
39 : /**
40 : * The variable type.
41 : */
42 : public DataType? variable_type {
43 116712959 : get { return _variable_type; }
44 24422804 : set {
45 48688037 : _variable_type = value;
46 24422804 : if (_variable_type != null) {
47 24265233 : _variable_type.parent_node = this;
48 : }
49 : }
50 : }
51 :
52 538368 : public bool single_assignment { get; set; }
53 :
54 16218207 : Expression? _initializer;
55 16218207 : DataType? _variable_type;
56 :
57 16218209 : protected Variable (DataType? variable_type, string? name, Expression? initializer = null, SourceReference? source_reference = null, Comment? comment = null) {
58 16218209 : base (name, source_reference, comment);
59 16218209 : this.variable_type = variable_type;
60 16218209 : this.initializer = initializer;
61 : }
62 : }
|