~ubuntu-branches/ubuntu/vivid/vala/vivid

« back to all changes in this revision

Viewing changes to vala/valavariable.vala

  • Committer: Bazaar Package Importer
  • Author(s): Sebastian Dröge
  • Date: 2010-07-28 07:58:01 UTC
  • mfrom: (1.5.5 upstream) (7.3.14 experimental)
  • Revision ID: james.westby@ubuntu.com-20100728075801-18u9cg5hv5oety6m
Tags: 0.9.4-1
New upstream development release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
public class Vala.Variable : Symbol {
 
24
        /**
 
25
         * The optional initializer expression.
 
26
         */
 
27
        public Expression? initializer {
 
28
                get {
 
29
                        return _initializer;
 
30
                }
 
31
                set {
 
32
                        _initializer = value;
 
33
                        if (_initializer != null) {
 
34
                                _initializer.parent_node = this;
 
35
                        }
 
36
                }
 
37
        }
 
38
        
 
39
        /**
 
40
         * The variable type.
 
41
         */
 
42
        public DataType? variable_type {
 
43
                get { return _variable_type; }
 
44
                set {
 
45
                        _variable_type = value;
 
46
                        if (_variable_type != null) {
 
47
                                _variable_type.parent_node = this;
 
48
                        }
 
49
                }
 
50
        }
 
51
 
 
52
        Expression? _initializer;
 
53
        DataType? _variable_type;
 
54
 
 
55
        public Variable (DataType? variable_type, string? name, Expression? initializer = null, SourceReference? source_reference = null, Comment? comment = null) {
 
56
                base (name, source_reference, comment);
 
57
                this.variable_type = variable_type;
 
58
                this.initializer = initializer;
 
59
        }
 
60
}