glib-2.0: Fix g_variant_new_tuple binding
[vala-lang.git] / vala / valaunresolvedsymbol.vala
blob40b4371591dcebc6ffdbf7d5f1309fc196fe38c7
1 /* valaunresolvedsymbol.vala
3 * Copyright (C) 2008-2009 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 /**
24 * An unresolved reference to a symbol.
26 public class Vala.UnresolvedSymbol : Symbol {
27 /**
28 * The parent of the symbol or null.
30 public UnresolvedSymbol? inner { get; set; }
32 /**
33 * Qualified access to global symbol.
35 public bool qualified { get; set; }
37 public UnresolvedSymbol (UnresolvedSymbol? inner, string name, SourceReference? source_reference = null) {
38 base (name, source_reference);
39 this.inner = inner;
42 public static UnresolvedSymbol? new_from_expression (Expression expr) {
43 var ma = expr as MemberAccess;
44 if (ma != null) {
45 if (ma.inner != null) {
46 return new UnresolvedSymbol (new_from_expression (ma.inner), ma.member_name, ma.source_reference);
47 } else {
48 return new UnresolvedSymbol (null, ma.member_name, ma.source_reference);
52 Report.error (expr.source_reference, "Type reference must be simple name or member access expression");
53 return null;
56 public override string to_string () {
57 if (inner == null) {
58 return name;
59 } else {
60 return "%s.%s".printf (inner.to_string (), name);
64 public UnresolvedSymbol copy () {
65 return new UnresolvedSymbol (inner, name, source_reference);