annotate dmd/TypeQualified.d @ 56:51605de93870

TupleExp.optimize UnrolledLoopStatement.ctor UnrolledLoopStatement.semantic UnrolledLoopStatement.blockExit OrOrExp.checkSideEffect FuncExp.syntaxCopy FuncLiteralDeclaration.syntaxCopy WhileStatement.hasBreak StructInitializer.toExpression StructLiteralExp.ctor StructLiteralExp.optimize BinExp.commonSemanticAssign ModAssignExp.opId Argument.isLazyArray CommaExp.implicitConvTo CommaExp.castTo TypeClass.isBaseOf createTypeInfoArray TypeTuple.getTypeInfoDeclaration TypeInfoTupleDeclaration.ctor TypeNext.constConv XorExp.implicitConvTo TemplateParameter.isTemplateValueParameter
author korDen
date Sat, 21 Aug 2010 14:16:53 +0400
parents 69d078c417c6
children 2e2a5c3f943a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
1 module dmd.TypeQualified;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
2
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
3 import dmd.Type;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
4 import dmd.Import;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
5 import dmd.TypeExp;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
6 import dmd.DotIdExp;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
7 import dmd.VarDeclaration;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
8 import dmd.EnumMember;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
9 import dmd.TupleDeclaration;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
10 import dmd.Id;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
11 import dmd.VarExp;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
12 import dmd.TemplateInstance;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
13 import dmd.Loc;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
14 import dmd.Array;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
15 import dmd.TY;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
16 import dmd.Identifier;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
17 import dmd.OutBuffer;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
18 import dmd.HdrGenState;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
19 import dmd.Scope;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
20 import dmd.Dsymbol;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
21 import dmd.DYNCAST;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
22 import dmd.Expression;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
23 import dmd.Util;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
24
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
25 class TypeQualified : Type
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
26 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
27 Loc loc;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
28 Array idents; // array of Identifier's representing ident.ident.ident etc.
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
29
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
30 this(TY ty, Loc loc)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
31 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
32 super(ty);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
33 this.loc = loc;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
34
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
35 idents = new Array();
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
36 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
37
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
38 version (DumbClone) {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
39 } else {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
40 Type clone()
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
41 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
42 assert(false);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
43 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
44 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
45 void syntaxCopyHelper(TypeQualified t)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
46 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
47 //printf("TypeQualified::syntaxCopyHelper(%s) %s\n", t->toChars(), toChars());
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
48 idents.setDim(t.idents.dim);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
49 for (int i = 0; i < idents.dim; i++)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
50 {
52
69d078c417c6 Identifier <-> TemplateInstance casts workaround
korDen
parents: 0
diff changeset
51 Object o = cast(Object)t.idents.data[i];
69d078c417c6 Identifier <-> TemplateInstance casts workaround
korDen
parents: 0
diff changeset
52 if (TemplateInstance ti = cast(TemplateInstance)o)
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
53 {
52
69d078c417c6 Identifier <-> TemplateInstance casts workaround
korDen
parents: 0
diff changeset
54 o = ti.syntaxCopy(null);
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
55 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
56
52
69d078c417c6 Identifier <-> TemplateInstance casts workaround
korDen
parents: 0
diff changeset
57 idents.data[i] = cast(void*)o;
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
58 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
59 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
60
52
69d078c417c6 Identifier <-> TemplateInstance casts workaround
korDen
parents: 0
diff changeset
61 void addIdent(Object ident)
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
62 {
56
51605de93870 TupleExp.optimize
korDen
parents: 52
diff changeset
63 assert(ident !is null);
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
64 idents.push(cast(void*)ident);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
65 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
66
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
67 void toCBuffer2Helper(OutBuffer buf, HdrGenState* hgs)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
68 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
69 int i;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
70
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
71 for (i = 0; i < idents.dim; i++)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
72 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
73 Identifier id = cast(Identifier)idents.data[i];
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
74 buf.writeByte('.');
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
75
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
76 if (id.dyncast() == DYNCAST.DYNCAST_DSYMBOL)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
77 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
78 TemplateInstance ti = cast(TemplateInstance)id;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
79 ti.toCBuffer(buf, hgs);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
80 } else {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
81 buf.writestring(id.toChars());
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
82 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
83 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
84 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
85
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
86 ulong size(Loc loc)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
87 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
88 assert(false);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
89 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
90
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
91 /*************************************
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
92 * Takes an array of Identifiers and figures out if
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
93 * it represents a Type or an Expression.
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
94 * Output:
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
95 * if expression, *pe is set
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
96 * if type, *pt is set
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
97 */
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
98 void resolveHelper(Loc loc, Scope sc, Dsymbol s, Dsymbol scopesym, Expression* pe, Type* pt, Dsymbol* ps)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
99 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
100 VarDeclaration v;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
101 EnumMember em;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
102 TupleDeclaration td;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
103 Expression e;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
104
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
105 static if (false) {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
106 printf("TypeQualified.resolveHelper(sc = %p, idents = '%s')\n", sc, toChars());
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
107 if (scopesym)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
108 printf("\tscopesym = '%s'\n", scopesym.toChars());
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
109 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
110 *pe = null;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
111 *pt = null;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
112 *ps = null;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
113 if (s)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
114 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
115 //printf("\t1: s = '%s' %p, kind = '%s'\n",s.toChars(), s, s.kind());
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
116 s.checkDeprecated(loc, sc); // check for deprecated aliases
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
117 s = s.toAlias();
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
118 //printf("\t2: s = '%s' %p, kind = '%s'\n",s.toChars(), s, s.kind());
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
119 for (int i = 0; i < idents.dim; i++)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
120 {
56
51605de93870 TupleExp.optimize
korDen
parents: 52
diff changeset
121 Object o = cast(Object)idents.data[i];
51605de93870 TupleExp.optimize
korDen
parents: 52
diff changeset
122
51605de93870 TupleExp.optimize
korDen
parents: 52
diff changeset
123 Dsymbol sm = s.searchX(loc, sc, o);
51605de93870 TupleExp.optimize
korDen
parents: 52
diff changeset
124 Identifier id = cast(Identifier)o;
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
125 //printf("\t3: s = '%s' %p, kind = '%s'\n",s.toChars(), s, s.kind());
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
126 //printf("\tgetType = '%s'\n", s.getType().toChars());
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
127 if (!sm)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
128 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
129 Type t;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
130
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
131 v = s.isVarDeclaration();
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
132 if (v && id == Id.length)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
133 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
134 e = v.getConstInitializer();
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
135 if (!e)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
136 e = new VarExp(loc, v);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
137 t = e.type;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
138 if (!t)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
139 goto Lerror;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
140 goto L3;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
141 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
142 t = s.getType();
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
143 if (!t && s.isDeclaration())
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
144 t = s.isDeclaration().type;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
145 if (t)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
146 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
147 sm = t.toDsymbol(sc);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
148 if (sm)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
149 { sm = sm.search(loc, id, 0);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
150 if (sm)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
151 goto L2;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
152 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
153 //e = t.getProperty(loc, id);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
154 e = new TypeExp(loc, t);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
155 e = t.dotExp(sc, e, id);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
156 i++;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
157 L3:
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
158 for (; i < idents.dim; i++)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
159 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
160 id = cast(Identifier)idents.data[i];
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
161 //printf("e: '%s', id: '%s', type = %p\n", e.toChars(), id.toChars(), e.type);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
162 if (id == Id.offsetof)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
163 { e = new DotIdExp(e.loc, e, id);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
164 e = e.semantic(sc);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
165 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
166 else
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
167 e = e.type.dotExp(sc, e, id);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
168 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
169 *pe = e;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
170 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
171 else
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
172 Lerror:
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
173 error(loc, "identifier '%s' of '%s' is not defined", id.toChars(), toChars());
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
174 return;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
175 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
176 L2:
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
177 s = sm.toAlias();
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
178 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
179
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
180 v = s.isVarDeclaration();
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
181 if (v)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
182 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
183 ///static if (false) {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
184 /// // It's not a type, it's an expression
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
185 /// Expression *e = v.getConstInitializer();
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
186 /// if (e)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
187 /// {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
188 /// *pe = e.copy(); // make copy so we can change loc
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
189 /// (*pe).loc = loc;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
190 /// }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
191 /// else
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
192 ///}
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
193 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
194 ///static if (false) {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
195 /// WithScopeSymbol withsym;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
196 /// if (scopesym && (withsym = scopesym.isWithScopeSymbol()) !is null)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
197 /// {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
198 /// // Same as wthis.ident
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
199 /// e = new VarExp(loc, withsym.withstate.wthis);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
200 /// e = new DotIdExp(loc, e, ident);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
201 /// //assert(0); // BUG: should handle this
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
202 /// }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
203 /// else
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
204 ///}
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
205 *pe = new VarExp(loc, v);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
206 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
207 return;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
208 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
209 em = s.isEnumMember();
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
210 if (em)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
211 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
212 // It's not a type, it's an expression
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
213 *pe = em.value.copy();
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
214 return;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
215 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
216
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
217 L1:
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
218 Type t = s.getType();
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
219 if (!t)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
220 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
221 // If the symbol is an import, try looking inside the import
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
222 Import si;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
223
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
224 si = s.isImport();
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
225 if (si)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
226 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
227 s = si.search(loc, s.ident, 0);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
228 if (s && s != si)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
229 goto L1;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
230 s = si;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
231 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
232 *ps = s;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
233 return;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
234 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
235 if (t.ty == TY.Tinstance && t != this && !t.deco)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
236 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
237 error(loc, "forward reference to '%s'", t.toChars());
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
238 return;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
239 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
240
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
241 if (t != this)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
242 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
243 if (t.reliesOnTident())
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
244 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
245 Scope scx;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
246
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
247 for (scx = sc; 1; scx = scx.enclosing)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
248 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
249 if (!scx)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
250 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
251 error(loc, "forward reference to '%s'", t.toChars());
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
252 return;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
253 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
254 if (scx.scopesym == scopesym)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
255 break;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
256 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
257 t = t.semantic(loc, scx);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
258 //((TypeIdentifier *)t).resolve(loc, scx, pe, &t, ps);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
259 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
260 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
261 if (t.ty == TY.Ttuple)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
262 *pt = t;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
263 else
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
264 *pt = t.merge();
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
265 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
266 if (!s)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
267 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
268 error(loc, "identifier '%s' is not defined", toChars());
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
269 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
270 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
271 }