Bump version suffix
[vala-lang.git] / vala / valanamedargument.vala
blobc88e8fce7096f73595d0389ba804919875e10bc5
1 /* valanamedargument.vala
3 * Copyright (C) 2009-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.NamedArgument : Expression {
24 public string name { get; set; }
26 public Expression inner {
27 get {
28 return _inner;
30 set {
31 _inner = value;
32 _inner.parent_node = this;
36 private Expression _inner;
38 public NamedArgument (string name, Expression inner, SourceReference? source_reference = null) {
39 this.name = name;
40 this.inner = inner;
41 this.source_reference = source_reference;
44 public override void accept (CodeVisitor visitor) {
45 visitor.visit_named_argument (this);
47 visitor.visit_expression (this);
50 public override void accept_children (CodeVisitor visitor) {
51 inner.accept (visitor);
54 public override void replace_expression (Expression old_node, Expression new_node) {
55 if (inner == old_node) {
56 inner = new_node;
60 public override bool is_pure () {
61 return inner.is_pure ();
64 public override bool check (CodeContext context) {
65 if (checked) {
66 return !error;
69 checked = true;
71 inner.target_type = target_type;
73 if (!inner.check (context)) {
74 error = true;
75 return false;
78 inner.target_type = inner.value_type;
79 value_type = inner.value_type;
81 return !error;
84 public override void emit (CodeGenerator codegen) {
85 inner.emit (codegen);
87 codegen.visit_named_argument (this);
89 codegen.visit_expression (this);
92 public override void get_defined_variables (Collection<LocalVariable> collection) {
93 inner.get_defined_variables (collection);
96 public override void get_used_variables (Collection<LocalVariable> collection) {
97 inner.get_used_variables (collection);