codegen: Fix floating reference regression with Variants
[vala-gnome.git] / vala / valavariable.vala
blob80a444c0b112c8abc77de535df90968b5ec10f96
1 /* valavariable.vala
3 * Copyright (C) 2010 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 public class Vala.Variable : Symbol {
24 /**
25 * The optional initializer expression.
27 public Expression? initializer {
28 get {
29 return _initializer;
31 set {
32 _initializer = value;
33 if (_initializer != null) {
34 _initializer.parent_node = this;
39 /**
40 * The variable type.
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;
52 public bool single_assignment { get; set; }
54 Expression? _initializer;
55 DataType? _variable_type;
57 public Variable (DataType? variable_type, string? name, Expression? initializer = null, SourceReference? source_reference = null, Comment? comment = null) {
58 base (name, source_reference, comment);
59 this.variable_type = variable_type;
60 this.initializer = initializer;