remove obsolete ref modifier and callback keyword
[vala-lang.git] / vala / valamemberaccess.vala
blob42598022c41235b7b0939c3f178e18941377c427
1 /* valamemberaccess.vala
3 * Copyright (C) 2006-2007 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 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 using GLib;
25 /**
26 * Represents an access to a type member in the source code.
28 public class Vala.MemberAccess : Expression {
29 /**
30 * The parent of the member.
32 public Expression inner {
33 get {
34 return _inner;
36 set {
37 _inner = value;
38 if (_inner != null) {
39 _inner.parent_node = this;
44 /**
45 * The name of the member.
47 public string! member_name { get; set construct; }
49 private Expression _inner;
50 private List<TypeReference> type_argument_list;
52 /**
53 * Creates a new member access expression.
55 * @param inner parent of the member
56 * @param member member name
57 * @param source reference to source code
58 * @return newly created member access expression
60 public MemberAccess (Expression _inner, string! member, SourceReference source = null) {
61 inner = _inner;
62 member_name = member;
63 source_reference = source;
66 public MemberAccess.simple (string! member, SourceReference source = null) {
67 member_name = member;
68 source_reference = source;
71 /**
72 * Appends the specified type as generic type argument.
74 * @param arg a type reference
76 public void add_type_argument (TypeReference! arg) {
77 type_argument_list.append (arg);
80 /**
81 * Returns a copy of the list of generic type arguments.
83 * @return type argument list
85 public List<weak TypeReference> get_type_arguments () {
86 return type_argument_list.copy ();
89 public override void accept (CodeVisitor! visitor) {
90 if (inner != null) {
91 inner.accept (visitor);
94 foreach (TypeReference type_arg in type_argument_list) {
95 type_arg.accept (visitor);
98 visitor.visit_member_access (this);
101 public override string! to_string () {
102 if (inner == null) {
103 return member_name;
104 } else {
105 return "%s.%s".printf (inner.to_string (), member_name);
109 public override void replace (CodeNode! old_node, CodeNode! new_node) {
110 if (inner == old_node) {
111 inner = (Expression) new_node;