annotate dmd/AliasDeclaration.d @ 72:2e2a5c3f943a

reduced warnings by adding override to the methods think this also normalizes different line endings used all over the place
author Trass3r
date Sat, 28 Aug 2010 16:19:48 +0200
parents 5c9b78899f5d
children 43073c7c7769
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
1 module dmd.AliasDeclaration;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
2
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
3 import dmd.LINK;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
4 import dmd.Declaration;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
5 import dmd.TypedefDeclaration;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
6 import dmd.VarDeclaration;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
7 import dmd.FuncDeclaration;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
8 import dmd.FuncAliasDeclaration;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
9 import dmd.Dsymbol;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
10 import dmd.ScopeDsymbol;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
11 import dmd.Loc;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
12 import dmd.Identifier;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
13 import dmd.Type;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
14 import dmd.OutBuffer;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
15 import dmd.HdrGenState;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
16 import dmd.Scope;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
17 import dmd.STC;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
18 import dmd.Expression;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
19 import dmd.Global;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
20
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
21 class AliasDeclaration : Declaration
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
22 {
16
5c9b78899f5d Implemented methods for Tuples, fixed some linking issues.
Robert Clipsham <robert@octarineparrot.com>
parents: 0
diff changeset
23 Dsymbol aliassym;
5c9b78899f5d Implemented methods for Tuples, fixed some linking issues.
Robert Clipsham <robert@octarineparrot.com>
parents: 0
diff changeset
24 Dsymbol overnext; // next in overload list
5c9b78899f5d Implemented methods for Tuples, fixed some linking issues.
Robert Clipsham <robert@octarineparrot.com>
parents: 0
diff changeset
25 int inSemantic;
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
26
16
5c9b78899f5d Implemented methods for Tuples, fixed some linking issues.
Robert Clipsham <robert@octarineparrot.com>
parents: 0
diff changeset
27 this(Loc loc, Identifier ident, Type type)
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
28 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
29 super(ident);
16
5c9b78899f5d Implemented methods for Tuples, fixed some linking issues.
Robert Clipsham <robert@octarineparrot.com>
parents: 0
diff changeset
30
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
31 //printf("AliasDeclaration(id = '%s', type = %p)\n", id.toChars(), type);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
32 //printf("type = '%s'\n", type.toChars());
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
33 this.loc = loc;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
34 this.type = type;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
35 this.aliassym = null;
16
5c9b78899f5d Implemented methods for Tuples, fixed some linking issues.
Robert Clipsham <robert@octarineparrot.com>
parents: 0
diff changeset
36 version (_DH) {
5c9b78899f5d Implemented methods for Tuples, fixed some linking issues.
Robert Clipsham <robert@octarineparrot.com>
parents: 0
diff changeset
37 this.htype = null;
5c9b78899f5d Implemented methods for Tuples, fixed some linking issues.
Robert Clipsham <robert@octarineparrot.com>
parents: 0
diff changeset
38 this.haliassym = null;
5c9b78899f5d Implemented methods for Tuples, fixed some linking issues.
Robert Clipsham <robert@octarineparrot.com>
parents: 0
diff changeset
39 }
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
40
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
41 assert(type);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
42 }
16
5c9b78899f5d Implemented methods for Tuples, fixed some linking issues.
Robert Clipsham <robert@octarineparrot.com>
parents: 0
diff changeset
43
5c9b78899f5d Implemented methods for Tuples, fixed some linking issues.
Robert Clipsham <robert@octarineparrot.com>
parents: 0
diff changeset
44 this(Loc loc, Identifier id, Dsymbol s)
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
45 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
46 super(id);
16
5c9b78899f5d Implemented methods for Tuples, fixed some linking issues.
Robert Clipsham <robert@octarineparrot.com>
parents: 0
diff changeset
47
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
48 //printf("AliasDeclaration(id = '%s', s = %p)\n", id->toChars(), s);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
49 assert(s !is this); /// huh?
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
50 this.loc = loc;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
51 this.type = null;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
52 this.aliassym = s;
16
5c9b78899f5d Implemented methods for Tuples, fixed some linking issues.
Robert Clipsham <robert@octarineparrot.com>
parents: 0
diff changeset
53 version (_DH) {
5c9b78899f5d Implemented methods for Tuples, fixed some linking issues.
Robert Clipsham <robert@octarineparrot.com>
parents: 0
diff changeset
54 this.htype = null;
5c9b78899f5d Implemented methods for Tuples, fixed some linking issues.
Robert Clipsham <robert@octarineparrot.com>
parents: 0
diff changeset
55 this.haliassym = null;
5c9b78899f5d Implemented methods for Tuples, fixed some linking issues.
Robert Clipsham <robert@octarineparrot.com>
parents: 0
diff changeset
56 }
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
57 assert(s);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
58 }
16
5c9b78899f5d Implemented methods for Tuples, fixed some linking issues.
Robert Clipsham <robert@octarineparrot.com>
parents: 0
diff changeset
59
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 16
diff changeset
60 override Dsymbol syntaxCopy(Dsymbol s)
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
61 {
16
5c9b78899f5d Implemented methods for Tuples, fixed some linking issues.
Robert Clipsham <robert@octarineparrot.com>
parents: 0
diff changeset
62 //printf("AliasDeclaration::syntaxCopy()\n");
5c9b78899f5d Implemented methods for Tuples, fixed some linking issues.
Robert Clipsham <robert@octarineparrot.com>
parents: 0
diff changeset
63 assert(!s);
5c9b78899f5d Implemented methods for Tuples, fixed some linking issues.
Robert Clipsham <robert@octarineparrot.com>
parents: 0
diff changeset
64 AliasDeclaration sa;
5c9b78899f5d Implemented methods for Tuples, fixed some linking issues.
Robert Clipsham <robert@octarineparrot.com>
parents: 0
diff changeset
65 if (type)
5c9b78899f5d Implemented methods for Tuples, fixed some linking issues.
Robert Clipsham <robert@octarineparrot.com>
parents: 0
diff changeset
66 sa = new AliasDeclaration(loc, ident, type.syntaxCopy());
5c9b78899f5d Implemented methods for Tuples, fixed some linking issues.
Robert Clipsham <robert@octarineparrot.com>
parents: 0
diff changeset
67 else
5c9b78899f5d Implemented methods for Tuples, fixed some linking issues.
Robert Clipsham <robert@octarineparrot.com>
parents: 0
diff changeset
68 sa = new AliasDeclaration(loc, ident, aliassym.syntaxCopy(null));
5c9b78899f5d Implemented methods for Tuples, fixed some linking issues.
Robert Clipsham <robert@octarineparrot.com>
parents: 0
diff changeset
69 version (_DH) {
5c9b78899f5d Implemented methods for Tuples, fixed some linking issues.
Robert Clipsham <robert@octarineparrot.com>
parents: 0
diff changeset
70 // Syntax copy for header file
5c9b78899f5d Implemented methods for Tuples, fixed some linking issues.
Robert Clipsham <robert@octarineparrot.com>
parents: 0
diff changeset
71 if (!htype) // Don't overwrite original
5c9b78899f5d Implemented methods for Tuples, fixed some linking issues.
Robert Clipsham <robert@octarineparrot.com>
parents: 0
diff changeset
72 { if (type) // Make copy for both old and new instances
5c9b78899f5d Implemented methods for Tuples, fixed some linking issues.
Robert Clipsham <robert@octarineparrot.com>
parents: 0
diff changeset
73 { htype = type.syntaxCopy();
5c9b78899f5d Implemented methods for Tuples, fixed some linking issues.
Robert Clipsham <robert@octarineparrot.com>
parents: 0
diff changeset
74 sa.htype = type.syntaxCopy();
5c9b78899f5d Implemented methods for Tuples, fixed some linking issues.
Robert Clipsham <robert@octarineparrot.com>
parents: 0
diff changeset
75 }
5c9b78899f5d Implemented methods for Tuples, fixed some linking issues.
Robert Clipsham <robert@octarineparrot.com>
parents: 0
diff changeset
76 }
5c9b78899f5d Implemented methods for Tuples, fixed some linking issues.
Robert Clipsham <robert@octarineparrot.com>
parents: 0
diff changeset
77 else // Make copy of original for new instance
5c9b78899f5d Implemented methods for Tuples, fixed some linking issues.
Robert Clipsham <robert@octarineparrot.com>
parents: 0
diff changeset
78 sa.htype = htype.syntaxCopy();
5c9b78899f5d Implemented methods for Tuples, fixed some linking issues.
Robert Clipsham <robert@octarineparrot.com>
parents: 0
diff changeset
79 if (!haliassym)
5c9b78899f5d Implemented methods for Tuples, fixed some linking issues.
Robert Clipsham <robert@octarineparrot.com>
parents: 0
diff changeset
80 { if (aliassym)
5c9b78899f5d Implemented methods for Tuples, fixed some linking issues.
Robert Clipsham <robert@octarineparrot.com>
parents: 0
diff changeset
81 { haliassym = aliassym.syntaxCopy(s);
5c9b78899f5d Implemented methods for Tuples, fixed some linking issues.
Robert Clipsham <robert@octarineparrot.com>
parents: 0
diff changeset
82 sa.haliassym = aliassym.syntaxCopy(s);
5c9b78899f5d Implemented methods for Tuples, fixed some linking issues.
Robert Clipsham <robert@octarineparrot.com>
parents: 0
diff changeset
83 }
5c9b78899f5d Implemented methods for Tuples, fixed some linking issues.
Robert Clipsham <robert@octarineparrot.com>
parents: 0
diff changeset
84 }
5c9b78899f5d Implemented methods for Tuples, fixed some linking issues.
Robert Clipsham <robert@octarineparrot.com>
parents: 0
diff changeset
85 else
5c9b78899f5d Implemented methods for Tuples, fixed some linking issues.
Robert Clipsham <robert@octarineparrot.com>
parents: 0
diff changeset
86 sa.haliassym = haliassym.syntaxCopy(s);
5c9b78899f5d Implemented methods for Tuples, fixed some linking issues.
Robert Clipsham <robert@octarineparrot.com>
parents: 0
diff changeset
87 } // version (_DH)
5c9b78899f5d Implemented methods for Tuples, fixed some linking issues.
Robert Clipsham <robert@octarineparrot.com>
parents: 0
diff changeset
88 return sa;
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
89 }
16
5c9b78899f5d Implemented methods for Tuples, fixed some linking issues.
Robert Clipsham <robert@octarineparrot.com>
parents: 0
diff changeset
90
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 16
diff changeset
91 override void semantic(Scope sc)
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
92 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
93 //printf("AliasDeclaration.semantic() %s\n", toChars());
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
94 if (aliassym)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
95 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
96 if (aliassym.isTemplateInstance())
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
97 aliassym.semantic(sc);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
98 return;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
99 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
100 this.inSemantic = 1;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
101
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
102 if (storage_class & STC.STCconst)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
103 error("cannot be const");
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
104
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
105 storage_class |= sc.stc & STC.STCdeprecated;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
106
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
107 // Given:
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
108 // alias foo.bar.abc def;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
109 // it is not knowable from the syntax whether this is an alias
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
110 // for a type or an alias for a symbol. It is up to the semantic()
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
111 // pass to distinguish.
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
112 // If it is a type, then type is set and getType() will return that
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
113 // type. If it is a symbol, then aliassym is set and type is null -
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
114 // toAlias() will return aliasssym.
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
115
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
116 Dsymbol s;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
117 Type t;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
118 Expression e;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
119
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
120 /* This section is needed because resolve() will:
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
121 * const x = 3;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
122 * alias x y;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
123 * try to alias y to 3.
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
124 */
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
125 s = type.toDsymbol(sc);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
126 if (s && ((s.getType() && type.equals(s.getType())) || s.isEnumMember()))
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
127 goto L2; // it's a symbolic alias
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
128
16
5c9b78899f5d Implemented methods for Tuples, fixed some linking issues.
Robert Clipsham <robert@octarineparrot.com>
parents: 0
diff changeset
129 ///version (DMDV2) {
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
130 if (storage_class & STC.STCref)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
131 { // For 'ref' to be attached to function types, and picked
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
132 // up by Type.resolve(), it has to go into sc.
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
133 sc = sc.push();
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
134 sc.stc |= STC.STCref;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
135 type.resolve(loc, sc, &e, &t, &s);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
136 sc = sc.pop();
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
137 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
138 else
16
5c9b78899f5d Implemented methods for Tuples, fixed some linking issues.
Robert Clipsham <robert@octarineparrot.com>
parents: 0
diff changeset
139 /// #endif
5c9b78899f5d Implemented methods for Tuples, fixed some linking issues.
Robert Clipsham <robert@octarineparrot.com>
parents: 0
diff changeset
140 type.resolve(loc, sc, &e, &t, &s);
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
141 if (s)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
142 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
143 goto L2;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
144 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
145 else if (e)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
146 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
147 // Try to convert Expression to Dsymbol
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
148 s = getDsymbol(e);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
149 if (s)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
150 goto L2;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
151
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
152 error("cannot alias an expression %s", e.toChars());
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
153 t = e.type;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
154 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
155 else if (t)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
156 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
157 type = t;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
158 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
159 if (overnext)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
160 ScopeDsymbol.multiplyDefined(Loc(0), this, overnext);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
161 this.inSemantic = 0;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
162 return;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
163
16
5c9b78899f5d Implemented methods for Tuples, fixed some linking issues.
Robert Clipsham <robert@octarineparrot.com>
parents: 0
diff changeset
164 L2:
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
165 //printf("alias is a symbol %s %s\n", s.kind(), s.toChars());
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
166 type = null;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
167 VarDeclaration v = s.isVarDeclaration();
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
168 if (v && v.linkage == LINK.LINKdefault)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
169 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
170 error("forward reference of %s", v.toChars());
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
171 s = null;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
172 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
173 else
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
174 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
175 FuncDeclaration f = s.toAlias().isFuncDeclaration();
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
176 if (f)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
177 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
178 if (overnext)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
179 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
180 FuncAliasDeclaration fa = new FuncAliasDeclaration(f);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
181 if (!fa.overloadInsert(overnext))
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
182 ScopeDsymbol.multiplyDefined(Loc(0), f, overnext);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
183 overnext = null;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
184 s = fa;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
185 s.parent = sc.parent;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
186 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
187 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
188 if (overnext)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
189 ScopeDsymbol.multiplyDefined(Loc(0), s, overnext);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
190 if (s == this)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
191 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
192 assert(global.errors);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
193 s = null;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
194 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
195 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
196 //printf("setting aliassym %p to %p\n", this, s);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
197 aliassym = s;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
198 this.inSemantic = 0;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
199 }
16
5c9b78899f5d Implemented methods for Tuples, fixed some linking issues.
Robert Clipsham <robert@octarineparrot.com>
parents: 0
diff changeset
200
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 16
diff changeset
201 override bool overloadInsert(Dsymbol s)
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
202 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
203 /* Don't know yet what the aliased symbol is, so assume it can
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
204 * be overloaded and check later for correctness.
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
205 */
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
206
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
207 //printf("AliasDeclaration.overloadInsert('%s')\n", s.toChars());
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
208 if (overnext is null)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
209 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
210 overnext = s;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
211 return true;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
212 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
213 else
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
214 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
215 return overnext.overloadInsert(s);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
216 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
217 }
16
5c9b78899f5d Implemented methods for Tuples, fixed some linking issues.
Robert Clipsham <robert@octarineparrot.com>
parents: 0
diff changeset
218
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 16
diff changeset
219 override string kind()
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
220 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
221 return "alias";
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
222 }
16
5c9b78899f5d Implemented methods for Tuples, fixed some linking issues.
Robert Clipsham <robert@octarineparrot.com>
parents: 0
diff changeset
223
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 16
diff changeset
224 override Type getType()
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
225 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
226 return type;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
227 }
16
5c9b78899f5d Implemented methods for Tuples, fixed some linking issues.
Robert Clipsham <robert@octarineparrot.com>
parents: 0
diff changeset
228
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 16
diff changeset
229 override Dsymbol toAlias()
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
230 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
231 //printf("AliasDeclaration::toAlias('%s', this = %p, aliassym = %p, kind = '%s')\n", toChars(), this, aliassym, aliassym ? aliassym->kind() : "");
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
232 assert(this !is aliassym);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
233 //static int count; if (++count == 10) *(char*)0=0;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
234 if (inSemantic)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
235 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
236 error("recursive alias declaration");
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
237 aliassym = new TypedefDeclaration(loc, ident, Type.terror, null);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
238 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
239
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
240 Dsymbol s = aliassym ? aliassym.toAlias() : this;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
241 return s;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
242 }
16
5c9b78899f5d Implemented methods for Tuples, fixed some linking issues.
Robert Clipsham <robert@octarineparrot.com>
parents: 0
diff changeset
243
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 16
diff changeset
244 override void toCBuffer(OutBuffer buf, HdrGenState* hgs)
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
245 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
246 assert(false);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
247 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
248
16
5c9b78899f5d Implemented methods for Tuples, fixed some linking issues.
Robert Clipsham <robert@octarineparrot.com>
parents: 0
diff changeset
249 version (_DH) {
5c9b78899f5d Implemented methods for Tuples, fixed some linking issues.
Robert Clipsham <robert@octarineparrot.com>
parents: 0
diff changeset
250 Type htype;
5c9b78899f5d Implemented methods for Tuples, fixed some linking issues.
Robert Clipsham <robert@octarineparrot.com>
parents: 0
diff changeset
251 Dsymbol haliassym;
5c9b78899f5d Implemented methods for Tuples, fixed some linking issues.
Robert Clipsham <robert@octarineparrot.com>
parents: 0
diff changeset
252 }
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 16
diff changeset
253 override void toDocBuffer(OutBuffer buf)
16
5c9b78899f5d Implemented methods for Tuples, fixed some linking issues.
Robert Clipsham <robert@octarineparrot.com>
parents: 0
diff changeset
254 {
5c9b78899f5d Implemented methods for Tuples, fixed some linking issues.
Robert Clipsham <robert@octarineparrot.com>
parents: 0
diff changeset
255 assert(false);
5c9b78899f5d Implemented methods for Tuples, fixed some linking issues.
Robert Clipsham <robert@octarineparrot.com>
parents: 0
diff changeset
256 }
5c9b78899f5d Implemented methods for Tuples, fixed some linking issues.
Robert Clipsham <robert@octarineparrot.com>
parents: 0
diff changeset
257
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 16
diff changeset
258 override AliasDeclaration isAliasDeclaration() { return this; }
16
5c9b78899f5d Implemented methods for Tuples, fixed some linking issues.
Robert Clipsham <robert@octarineparrot.com>
parents: 0
diff changeset
259 }