Mercurial > projects > ddmd
annotate dmd/TemplateInstance.d @ 131:206db751bd4c
dmdfe 2.037 compiles now
author | Eldar Insafutdinov <e.insafutdinov@gmail.com> |
---|---|
date | Fri, 10 Sep 2010 00:27:37 +0100 |
parents | 60bb0fe4563e |
children | af1bebfd96a4 |
rev | line source |
---|---|
0 | 1 module dmd.TemplateInstance; |
2 | |
114 | 3 import dmd.common; |
0 | 4 import dmd.ScopeDsymbol; |
5 import dmd.IntegerExp; | |
6 import dmd.Identifier; | |
7 import dmd.ArrayTypes; | |
8 import dmd.TupleDeclaration; | |
9 import dmd.TemplateParameter; | |
10 import dmd.AliasDeclaration; | |
11 import dmd.TemplateDeclaration; | |
12 import dmd.TupleExp; | |
13 import dmd.WithScopeSymbol; | |
14 import dmd.Dsymbol; | |
15 import dmd.Module; | |
16 import dmd.ArrayTypes; | |
17 import dmd.Loc; | |
18 import dmd.Global; | |
19 import dmd.Util; | |
20 import dmd.Type; | |
21 import dmd.Expression; | |
22 import dmd.Tuple; | |
23 import dmd.STC; | |
24 import dmd.TOK; | |
25 import dmd.TY; | |
26 import dmd.TypeTuple; | |
130
60bb0fe4563e
dmdfe 2.037 first main iteration
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
128
diff
changeset
|
27 import dmd.Parameter; |
0 | 28 import dmd.WANT; |
29 import dmd.ExpInitializer; | |
30 import dmd.Array; | |
31 import dmd.DsymbolTable; | |
32 import dmd.Scope; | |
33 import dmd.OutBuffer; | |
34 import dmd.HdrGenState; | |
35 import dmd.VarDeclaration; | |
36 import dmd.VarExp; | |
37 import dmd.FuncExp; | |
38 import dmd.Declaration; | |
39 import dmd.MATCH; | |
131
206db751bd4c
dmdfe 2.037 compiles now
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
130
diff
changeset
|
40 import dmd.TypeFunction; |
206db751bd4c
dmdfe 2.037 compiles now
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
130
diff
changeset
|
41 import dmd.TemplateTupleParameter; |
206db751bd4c
dmdfe 2.037 compiles now
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
130
diff
changeset
|
42 import dmd.FuncDeclaration; |
20
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
43 import dmd.templates.Util; |
0 | 44 |
45 import dmd.backend.glue; | |
46 | |
47 Tuple isTuple(Object o) | |
48 { | |
49 //return dynamic_cast<Tuple *>(o); | |
50 ///if (!o || o.dyncast() != DYNCAST_TUPLE) | |
51 /// return null; | |
52 return cast(Tuple)o; | |
53 } | |
54 | |
55 /****************************** | |
56 * If o1 matches o2, return 1. | |
57 * Else, return 0. | |
58 */ | |
59 | |
60 bool match(Object o1, Object o2, TemplateDeclaration tempdecl, Scope sc) | |
61 { | |
62 Type t1 = isType(o1); | |
63 Type t2 = isType(o2); | |
64 Expression e1 = isExpression(o1); | |
65 Expression e2 = isExpression(o2); | |
66 Dsymbol s1 = isDsymbol(o1); | |
67 Dsymbol s2 = isDsymbol(o2); | |
68 Tuple v1 = isTuple(o1); | |
69 Tuple v2 = isTuple(o2); | |
70 | |
71 //printf("\t match t1 %p t2 %p, e1 %p e2 %p, s1 %p s2 %p, v1 %p v2 %p\n", t1,t2,e1,e2,s1,s2,v1,v2); | |
72 | |
73 /* A proper implementation of the various equals() overrides | |
74 * should make it possible to just do o1.equals(o2), but | |
75 * we'll do that another day. | |
76 */ | |
77 | |
78 if (t1) | |
79 { | |
80 /* if t1 is an instance of ti, then give error | |
81 * about recursive expansions. | |
82 */ | |
83 Dsymbol s = t1.toDsymbol(sc); | |
84 if (s && s.parent) | |
85 { | |
86 TemplateInstance ti1 = s.parent.isTemplateInstance(); | |
87 if (ti1 && ti1.tempdecl == tempdecl) | |
88 { | |
89 for (Scope sc1 = sc; sc1; sc1 = sc1.enclosing) | |
90 { | |
91 if (sc1.scopesym == ti1) | |
92 { | |
93 error("recursive template expansion for template argument %s", t1.toChars()); | |
94 return true; // fake a match | |
95 } | |
96 } | |
97 } | |
98 } | |
99 | |
100 //printf("t1 = %s\n", t1.toChars()); | |
101 //printf("t2 = %s\n", t2.toChars()); | |
102 if (!t2 || !t1.equals(t2)) | |
103 goto Lnomatch; | |
104 } | |
105 else if (e1) | |
106 { | |
107 static if (false) { | |
108 if (e1 && e2) | |
109 { | |
110 printf("match %d\n", e1.equals(e2)); | |
111 e1.print(); | |
112 e2.print(); | |
113 e1.type.print(); | |
114 e2.type.print(); | |
115 } | |
116 } | |
117 if (!e2) | |
118 goto Lnomatch; | |
119 if (!e1.equals(e2)) | |
120 goto Lnomatch; | |
121 } | |
122 else if (s1) | |
123 { | |
124 //printf("%p %s, %p %s\n", s1, s1.toChars(), s2, s2.toChars()); | |
125 if (!s2 || !s1.equals(s2) || s1.parent != s2.parent) | |
126 { | |
127 goto Lnomatch; | |
128 } | |
129 version (DMDV2) { | |
130 VarDeclaration vv1 = s1.isVarDeclaration(); | |
131 VarDeclaration vv2 = s2.isVarDeclaration(); | |
132 if (vv1 && vv2 && vv1.storage_class & vv2.storage_class & STCmanifest) | |
133 { | |
134 ExpInitializer ei1 = vv1.init.isExpInitializer(); | |
135 ExpInitializer ei2 = vv2.init.isExpInitializer(); | |
136 if (ei1 && ei2 && !ei1.exp.equals(ei2.exp)) | |
137 goto Lnomatch; | |
138 } | |
139 } | |
140 } | |
141 else if (v1) | |
142 { | |
143 if (!v2) | |
144 goto Lnomatch; | |
145 | |
146 if (v1.objects.dim != v2.objects.dim) | |
147 goto Lnomatch; | |
148 | |
149 for (size_t i = 0; i < v1.objects.dim; i++) | |
150 { | |
113
3482c73a991b
More cleanup for arrays
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
110
diff
changeset
|
151 if (!match(v1.objects[i], v2.objects[i], tempdecl, sc)) |
0 | 152 goto Lnomatch; |
153 } | |
154 } | |
155 //printf("match\n"); | |
156 return true; // match | |
157 | |
158 Lnomatch: | |
159 //printf("nomatch\n"); | |
160 return false; // nomatch; | |
161 } | |
162 | |
163 class TemplateInstance : ScopeDsymbol | |
164 { | |
165 /* Given: | |
166 * foo!(args) => | |
167 * name = foo | |
168 * tiargs = args | |
169 */ | |
170 Identifier name; | |
171 //Array idents; | |
172 Objects tiargs; // Array of Types/Expressions of template | |
173 // instance arguments [int*, char, 10*10] | |
174 | |
175 Objects tdtypes; // Array of Types/Expressions corresponding | |
176 // to TemplateDeclaration.parameters | |
177 // [int, char, 100] | |
178 | |
179 TemplateDeclaration tempdecl; // referenced by foo.bar.abc | |
180 TemplateInstance inst; // refer to existing instance | |
181 TemplateInstance tinst; // enclosing template instance | |
182 ScopeDsymbol argsym; // argument symbol table | |
183 AliasDeclaration aliasdecl; // !=null if instance is an alias for its | |
184 // sole member | |
185 WithScopeSymbol withsym; // if a member of a with statement | |
186 int semanticRun; // has semantic() been done? | |
187 int semantictiargsdone; // has semanticTiargs() been done? | |
188 int nest; // for recursion detection | |
189 int havetempdecl; // 1 if used second constructor | |
190 Dsymbol isnested; // if referencing local symbols, this is the context | |
191 int errors; // 1 if compiled with errors | |
192 version (IN_GCC) { | |
193 /* On some targets, it is necessary to know whether a symbol | |
194 will be emitted in the output or not before the symbol | |
195 is used. This can be different from getModule(). */ | |
196 Module objFileModule; | |
197 } | |
198 | |
199 this(Loc loc, Identifier ident) | |
200 { | |
201 super(null); | |
202 | |
203 version (LOG) { | |
204 printf("TemplateInstance(this = %p, ident = '%s')\n", this, ident ? ident.toChars() : "null"); | |
205 } | |
206 this.loc = loc; | |
207 this.name = ident; | |
208 | |
209 tdtypes = new Objects(); | |
210 } | |
211 | |
212 /***************** | |
213 * This constructor is only called when we figured out which function | |
214 * template to instantiate. | |
215 */ | |
216 this(Loc loc, TemplateDeclaration td, Objects tiargs) | |
217 { | |
218 super(null); | |
219 | |
220 version (LOG) { | |
221 printf("TemplateInstance(this = %p, tempdecl = '%s')\n", this, td.toChars()); | |
222 } | |
223 this.loc = loc; | |
224 this.name = td.ident; | |
225 this.tiargs = tiargs; | |
226 this.tempdecl = td; | |
227 this.semantictiargsdone = 1; | |
228 this.havetempdecl = 1; | |
229 | |
230 assert(cast(size_t)cast(void*)tempdecl.scope_ > 0x10000); | |
231 | |
232 tdtypes = new Objects(); | |
233 } | |
234 | |
235 static Objects arraySyntaxCopy(Objects objs) | |
236 { | |
20
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
237 Objects a = null; |
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
238 if (objs) |
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
239 { a = new Objects(); |
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
240 a.setDim(objs.dim); |
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
241 for (size_t i = 0; i < objs.dim; i++) |
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
242 { |
94
3a0b150c9841
Objects -> Vector!Object iteration 1
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
91
diff
changeset
|
243 a[i] = objectSyntaxCopy(objs[i]); |
20
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
244 } |
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
245 } |
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
246 return a; |
0 | 247 } |
248 | |
72 | 249 override Dsymbol syntaxCopy(Dsymbol s) |
0 | 250 { |
20
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
251 TemplateInstance ti; |
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
252 |
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
253 if (s) |
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
254 ti = cast(TemplateInstance)s; |
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
255 else |
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
256 ti = new TemplateInstance(loc, name); |
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
257 |
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
258 ti.tiargs = arraySyntaxCopy(tiargs); |
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
259 |
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
260 ScopeDsymbol.syntaxCopy(ti); |
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
261 return ti; |
0 | 262 } |
263 | |
72 | 264 override void semantic(Scope sc) |
0 | 265 { |
266 if (global.errors) | |
267 { | |
268 if (!global.gag) | |
269 { | |
270 /* Trying to soldier on rarely generates useful messages | |
271 * at this point. | |
272 */ | |
273 fatal(); | |
274 } | |
275 return; | |
276 } | |
277 | |
278 version (LOG) { | |
279 printf("\n+TemplateInstance.semantic('%s', this=%p)\n", toChars(), this); | |
280 } | |
281 | |
282 if (inst) // if semantic() was already run | |
283 { | |
284 version (LOG) { | |
285 printf("-TemplateInstance.semantic('%s', this=%p) already run\n", inst.toChars(), inst); | |
286 } | |
287 return; | |
288 } | |
289 | |
290 // get the enclosing template instance from the scope tinst | |
291 tinst = sc.tinst; | |
292 | |
293 if (semanticRun != 0) | |
294 { | |
295 error(loc, "recursive template expansion"); | |
296 // inst = this; | |
297 return; | |
298 } | |
299 | |
300 semanticRun = 1; | |
301 | |
302 version (LOG) { | |
303 printf("\tdo semantic\n"); | |
304 } | |
305 if (havetempdecl) | |
306 { | |
307 assert(cast(size_t)cast(void*)tempdecl.scope_ > 0x10000); | |
308 | |
309 // Deduce tdtypes | |
310 tdtypes.setDim(tempdecl.parameters.dim); | |
311 if (!tempdecl.matchWithInstance(this, tdtypes, 2)) | |
312 { | |
313 error("incompatible arguments for template instantiation"); | |
314 inst = this; | |
315 return; | |
316 } | |
317 } | |
318 else | |
319 { | |
320 /* Run semantic on each argument, place results in tiargs[] | |
321 * (if we havetempdecl, then tiargs is already evaluated) | |
322 */ | |
323 semanticTiargs(sc); | |
324 | |
325 tempdecl = findTemplateDeclaration(sc); | |
326 if (tempdecl) | |
327 tempdecl = findBestMatch(sc); | |
328 | |
329 if (!tempdecl || global.errors) | |
330 { | |
331 inst = this; | |
332 //printf("error return %p, %d\n", tempdecl, global.errors); | |
333 return; // error recovery | |
334 } | |
335 } | |
336 | |
337 hasNestedArgs(tiargs); | |
338 | |
339 /* See if there is an existing TemplateInstantiation that already | |
340 * implements the typeargs. If so, just refer to that one instead. | |
341 */ | |
342 | |
128
e6e542f37b94
Some more Array -> Vector conversions
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
126
diff
changeset
|
343 foreach (ti; tempdecl.instances) |
0 | 344 { |
345 version (LOG) { | |
346 printf("\t%s: checking for match with instance %d (%p): '%s'\n", toChars(), i, ti, ti.toChars()); | |
347 } | |
348 assert(tdtypes.dim == ti.tdtypes.dim); | |
349 | |
350 // Nesting must match | |
351 if (isnested !is ti.isnested) | |
352 { | |
353 //printf("test2 isnested %s ti.isnested %s\n", isnested ? isnested.toChars() : "", ti.isnested ? ti.isnested.toChars() : ""); | |
354 continue; | |
355 } | |
356 static if (false) { | |
357 if (isnested && sc.parent != ti.parent) | |
358 continue; | |
359 } | |
360 for (size_t j = 0; j < tdtypes.dim; j++) | |
361 { | |
113
3482c73a991b
More cleanup for arrays
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
110
diff
changeset
|
362 Object o1 = tdtypes[j]; |
3482c73a991b
More cleanup for arrays
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
110
diff
changeset
|
363 Object o2 = ti.tdtypes[j]; |
0 | 364 if (!match(o1, o2, tempdecl, sc)) |
365 { | |
366 goto L1; | |
367 } | |
368 } | |
369 | |
370 // It's a match | |
371 inst = ti; | |
372 parent = ti.parent; | |
373 version (LOG) { | |
374 printf("\tit's a match with instance %p\n", inst); | |
375 } | |
376 return; | |
377 | |
378 L1: | |
379 ; | |
380 } | |
381 | |
382 /* So, we need to implement 'this' instance. | |
383 */ | |
384 version (LOG) { | |
385 printf("\timplement template instance '%s'\n", toChars()); | |
386 } | |
387 uint errorsave = global.errors; | |
388 inst = this; | |
389 int tempdecl_instance_idx = tempdecl.instances.dim; | |
128
e6e542f37b94
Some more Array -> Vector conversions
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
126
diff
changeset
|
390 tempdecl.instances.push(this); |
0 | 391 parent = tempdecl.parent; |
392 //printf("parent = '%s'\n", parent.kind()); | |
393 | |
394 ident = genIdent(); // need an identifier for name mangling purposes. | |
395 | |
396 static if (true) { | |
397 if (isnested) | |
398 parent = isnested; | |
399 } | |
400 //printf("parent = '%s'\n", parent.kind()); | |
401 | |
402 // Add 'this' to the enclosing scope's members[] so the semantic routines | |
403 // will get called on the instance members | |
404 static if (true) { | |
405 int dosemantic3 = 0; | |
406 { | |
74
7e0d548de9e6
Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
72
diff
changeset
|
407 Dsymbols a; |
0 | 408 |
409 Scope scx = sc; | |
410 static if (false) { | |
411 for (scx = sc; scx; scx = scx.enclosing) | |
412 if (scx.scopesym) | |
413 break; | |
414 } | |
415 | |
416 //if (scx && scx.scopesym) printf("3: scx is %s %s\n", scx.scopesym.kind(), scx.scopesym.toChars()); | |
417 if (scx && scx.scopesym && | |
418 scx.scopesym.members && !scx.scopesym.isTemplateMixin() | |
419 | |
420 /// static if (false) { // removed because it bloated compile times | |
421 /// /* The problem is if A imports B, and B imports A, and both A | |
422 /// * and B instantiate the same template, does the compilation of A | |
423 /// * or the compilation of B do the actual instantiation? | |
424 /// * | |
425 /// * see bugzilla 2500. | |
426 /// */ | |
427 /// && !scx.module.selfImports() | |
428 /// } | |
429 ) | |
430 { | |
431 //printf("\t1: adding to %s %s\n", scx.scopesym.kind(), scx.scopesym.toChars()); | |
432 a = scx.scopesym.members; | |
433 } | |
434 else | |
435 { Module m = sc.module_.importedFrom; | |
436 //printf("\t2: adding to module %s instead of module %s\n", m.toChars(), sc.module.toChars()); | |
437 a = m.members; | |
438 if (m.semanticRun >= 3) | |
439 dosemantic3 = 1; | |
440 } | |
441 | |
442 for (int i = 0; 1; i++) | |
443 { | |
444 if (i == a.dim) | |
445 { | |
74
7e0d548de9e6
Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
72
diff
changeset
|
446 a.push(this); |
0 | 447 break; |
448 } | |
449 | |
74
7e0d548de9e6
Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
72
diff
changeset
|
450 if (this is a[i]) // if already in Array |
0 | 451 break; |
452 } | |
453 } | |
454 } | |
455 | |
456 // Copy the syntax trees from the TemplateDeclaration | |
457 members = Dsymbol.arraySyntaxCopy(tempdecl.members); | |
458 | |
459 // Create our own scope for the template parameters | |
460 Scope scope_ = tempdecl.scope_; | |
461 if (!tempdecl.semanticRun) | |
462 { | |
463 error("template instantiation %s forward references template declaration %s\n", toChars(), tempdecl.toChars()); | |
464 return; | |
465 } | |
466 | |
467 version (LOG) { | |
468 printf("\tcreate scope for template parameters '%s'\n", toChars()); | |
469 } | |
470 argsym = new ScopeDsymbol(); | |
471 argsym.parent = scope_.parent; | |
472 scope_ = scope_.push(argsym); | |
473 // scope.stc = 0; | |
474 | |
475 // Declare each template parameter as an alias for the argument type | |
476 Scope paramscope = scope_.push(); | |
477 paramscope.stc = STCundefined; | |
478 declareParameters(paramscope); | |
479 paramscope.pop(); | |
480 | |
481 // Add members of template instance to template instance symbol table | |
482 // parent = scope.scopesym; | |
483 symtab = new DsymbolTable(); | |
13 | 484 bool memnum = false; |
77
ad4792a1cfd6
more D-ification container accessing
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
74
diff
changeset
|
485 foreach(Dsymbol s; members) |
0 | 486 { |
487 version (LOG) { | |
488 printf("\t[%d] adding member '%s' %p kind %s to '%s', memnum = %d\n", i, s.toChars(), s, s.kind(), this.toChars(), memnum); | |
489 } | |
490 memnum |= s.addMember(scope_, this, memnum); | |
491 } | |
492 | |
493 version (LOG) { | |
494 printf("adding members done\n"); | |
495 } | |
496 | |
497 /* See if there is only one member of template instance, and that | |
498 * member has the same name as the template instance. | |
499 * If so, this template instance becomes an alias for that member. | |
500 */ | |
501 //printf("members.dim = %d\n", members.dim); | |
502 if (members.dim) | |
503 { | |
504 Dsymbol s; | |
505 if (Dsymbol.oneMembers(members, &s) && s) | |
506 { | |
507 //printf("s.kind = '%s'\n", s.kind()); | |
508 //s.print(); | |
509 //printf("'%s', '%s'\n", s.ident.toChars(), tempdecl.ident.toChars()); | |
510 if (s.ident && s.ident.equals(tempdecl.ident)) | |
511 { | |
512 //printf("setting aliasdecl\n"); | |
513 aliasdecl = new AliasDeclaration(loc, s.ident, s); | |
514 } | |
515 } | |
516 } | |
517 | |
518 // Do semantic() analysis on template instance members | |
519 version (LOG) { | |
520 printf("\tdo semantic() on template instance members '%s'\n", toChars()); | |
521 } | |
522 Scope sc2; | |
523 sc2 = scope_.push(this); | |
524 //printf("isnested = %d, sc.parent = %s\n", isnested, sc.parent.toChars()); | |
525 sc2.parent = /*isnested ? sc.parent :*/ this; | |
526 sc2.tinst = this; | |
527 | |
528 try | |
529 { | |
79 | 530 // static int nest; |
0 | 531 //printf("%d\n", nest); |
532 if (++nest > 500) | |
533 { | |
534 global.gag = 0; // ensure error message gets printed | |
535 error("recursive expansion"); | |
536 fatal(); | |
537 } | |
77
ad4792a1cfd6
more D-ification container accessing
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
74
diff
changeset
|
538 foreach(Dsymbol s; members) |
0 | 539 { |
540 //printf("\t[%d] semantic on '%s' %p kind %s in '%s'\n", i, s.toChars(), s, s.kind(), this.toChars()); | |
541 //printf("test: isnested = %d, sc2.parent = %s\n", isnested, sc2.parent.toChars()); | |
542 // if (isnested) | |
543 // s.parent = sc.parent; | |
544 //printf("test3: isnested = %d, s.parent = %s\n", isnested, s.parent.toChars()); | |
545 s.semantic(sc2); | |
546 //printf("test4: isnested = %d, s.parent = %s\n", isnested, s.parent.toChars()); | |
547 sc2.module_.runDeferredSemantic(); | |
548 } | |
549 --nest; | |
550 } | |
20
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
551 catch (Exception e) |
0 | 552 { |
553 global.gag = 0; // ensure error message gets printed | |
554 error("recursive expansion"); | |
555 fatal(); | |
556 } | |
557 | |
558 /* If any of the instantiation members didn't get semantic() run | |
559 * on them due to forward references, we cannot run semantic2() | |
560 * or semantic3() yet. | |
561 */ | |
562 for (size_t i = 0; i < Module.deferred.dim; i++) | |
563 { | |
564 Dsymbol sd = cast(Dsymbol)Module.deferred.data[i]; | |
565 | |
566 if (sd.parent is this) | |
567 goto Laftersemantic; | |
568 } | |
569 | |
570 /* The problem is when to parse the initializer for a variable. | |
571 * Perhaps VarDeclaration.semantic() should do it like it does | |
572 * for initializers inside a function. | |
573 */ | |
574 // if (sc.parent.isFuncDeclaration()) | |
575 | |
576 /* BUG 782: this has problems if the classes this depends on | |
577 * are forward referenced. Find a way to defer semantic() | |
578 * on this template. | |
579 */ | |
580 semantic2(sc2); | |
581 | |
582 if (sc.func || dosemantic3) | |
583 { | |
79 | 584 try |
585 { | |
586 // static int nest; // TODO: | |
587 if (++nest > 300) | |
588 { | |
589 global.gag = 0; // ensure error message gets printed | |
590 error("recursive expansion"); | |
591 fatal(); | |
592 } | |
593 semantic3(sc2); | |
594 --nest; | |
595 } | |
596 catch (Exception e) | |
597 { | |
598 global.gag = 0; // ensure error message gets printed | |
599 error("recursive expansion"); | |
600 fatal(); | |
601 } | |
0 | 602 } |
603 | |
604 Laftersemantic: | |
605 sc2.pop(); | |
606 | |
607 scope_.pop(); | |
608 | |
609 // Give additional context info if error occurred during instantiation | |
610 if (global.errors != errorsave) | |
611 { | |
612 error("error instantiating"); | |
613 if (tinst && !global.gag) | |
614 { | |
615 tinst.printInstantiationTrace(); | |
616 fatal(); | |
617 } | |
618 errors = 1; | |
619 if (global.gag) | |
620 tempdecl.instances.remove(tempdecl_instance_idx); | |
621 } | |
622 | |
623 version (LOG) { | |
624 printf("-TemplateInstance.semantic('%s', this=%p)\n", toChars(), this); | |
625 } | |
626 } | |
627 | |
72 | 628 override void semantic2(Scope sc) |
0 | 629 { |
630 if (semanticRun >= 2) | |
631 return; | |
632 | |
633 semanticRun = 2; | |
634 version (LOG) { | |
20
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
635 printf("+TemplateInstance.semantic2('%s')\n", toChars()); |
0 | 636 } |
637 | |
638 if (!errors && members) | |
639 { | |
640 sc = tempdecl.scope_; | |
641 assert(sc); | |
642 sc = sc.push(argsym); | |
643 sc = sc.push(this); | |
644 sc.tinst = this; | |
645 | |
77
ad4792a1cfd6
more D-ification container accessing
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
74
diff
changeset
|
646 foreach(Dsymbol s; members) |
0 | 647 { |
648 version (LOG) { | |
649 printf("\tmember '%s', kind = '%s'\n", s.toChars(), s.kind()); | |
650 } | |
651 s.semantic2(sc); | |
652 } | |
653 | |
654 sc = sc.pop(); | |
655 sc.pop(); | |
656 } | |
657 | |
658 version (LOG) { | |
20
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
659 printf("-TemplateInstance.semantic2('%s')\n", toChars()); |
0 | 660 } |
661 } | |
662 | |
72 | 663 override void semantic3(Scope sc) |
0 | 664 { |
665 version (LOG) { | |
666 printf("TemplateInstance.semantic3('%s'), semanticRun = %d\n", toChars(), semanticRun); | |
667 } | |
668 //if (toChars()[0] == 'D') *(char*)0=0; | |
669 if (semanticRun >= 3) | |
670 return; | |
671 semanticRun = 3; | |
672 if (!errors && members) | |
673 { | |
674 sc = tempdecl.scope_; | |
675 sc = sc.push(argsym); | |
676 sc = sc.push(this); | |
677 sc.tinst = this; | |
77
ad4792a1cfd6
more D-ification container accessing
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
74
diff
changeset
|
678 foreach(Dsymbol s; members) |
0 | 679 s.semantic3(sc); |
680 sc = sc.pop(); | |
681 sc.pop(); | |
682 } | |
683 } | |
684 | |
72 | 685 override void inlineScan() |
0 | 686 { |
687 version (LOG) { | |
688 printf("TemplateInstance.inlineScan('%s')\n", toChars()); | |
689 } | |
690 if (!errors && members) | |
691 { | |
77
ad4792a1cfd6
more D-ification container accessing
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
74
diff
changeset
|
692 foreach(Dsymbol s; members) |
0 | 693 s.inlineScan(); |
694 } | |
695 } | |
696 | |
72 | 697 override void toCBuffer(OutBuffer buf, HdrGenState* hgs) |
0 | 698 { |
699 int i; | |
700 | |
701 Identifier id = name; | |
702 buf.writestring(id.toChars()); | |
703 buf.writestring("!("); | |
704 if (nest) | |
705 buf.writestring("..."); | |
706 else | |
707 { | |
708 nest++; | |
709 Objects args = tiargs; | |
710 for (i = 0; i < args.dim; i++) | |
711 { | |
712 if (i) | |
713 buf.writeByte(','); | |
113
3482c73a991b
More cleanup for arrays
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
110
diff
changeset
|
714 Object oarg = args[i]; |
0 | 715 ObjectToCBuffer(buf, hgs, oarg); |
716 } | |
717 nest--; | |
718 } | |
719 buf.writeByte(')'); | |
720 } | |
721 | |
72 | 722 override Dsymbol toAlias() // resolve real symbol |
0 | 723 { |
79 | 724 version (LOG) |
725 { | |
726 writef("TemplateInstance.toAlias()\n"); | |
0 | 727 } |
728 if (!inst) | |
729 { | |
730 error("cannot resolve forward reference"); | |
79 | 731 errors = 1; |
0 | 732 return this; |
733 } | |
734 | |
735 if (inst !is this) | |
736 return inst.toAlias(); | |
737 | |
738 if (aliasdecl) | |
739 { | |
740 return aliasdecl.toAlias(); | |
741 } | |
742 | |
743 return inst; | |
744 } | |
745 | |
72 | 746 override string kind() |
0 | 747 { |
20
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
748 return "template instance"; |
0 | 749 } |
750 | |
72 | 751 override bool oneMember(Dsymbol* ps) |
0 | 752 { |
20
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
753 *ps = null; |
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
754 return true; |
0 | 755 } |
130
60bb0fe4563e
dmdfe 2.037 first main iteration
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
128
diff
changeset
|
756 |
60bb0fe4563e
dmdfe 2.037 first main iteration
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
128
diff
changeset
|
757 /***************************************************** |
60bb0fe4563e
dmdfe 2.037 first main iteration
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
128
diff
changeset
|
758 * Determine if template instance is really a template function, |
60bb0fe4563e
dmdfe 2.037 first main iteration
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
128
diff
changeset
|
759 * and that template function needs to infer types from the function |
60bb0fe4563e
dmdfe 2.037 first main iteration
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
128
diff
changeset
|
760 * arguments. |
60bb0fe4563e
dmdfe 2.037 first main iteration
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
128
diff
changeset
|
761 */ |
60bb0fe4563e
dmdfe 2.037 first main iteration
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
128
diff
changeset
|
762 |
60bb0fe4563e
dmdfe 2.037 first main iteration
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
128
diff
changeset
|
763 bool needsTypeInference(Scope sc) |
60bb0fe4563e
dmdfe 2.037 first main iteration
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
128
diff
changeset
|
764 { |
60bb0fe4563e
dmdfe 2.037 first main iteration
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
128
diff
changeset
|
765 //printf("TemplateInstance::needsTypeInference() %s\n", toChars()); |
60bb0fe4563e
dmdfe 2.037 first main iteration
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
128
diff
changeset
|
766 if (!tempdecl) |
60bb0fe4563e
dmdfe 2.037 first main iteration
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
128
diff
changeset
|
767 tempdecl = findTemplateDeclaration(sc); |
60bb0fe4563e
dmdfe 2.037 first main iteration
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
128
diff
changeset
|
768 for (TemplateDeclaration td = tempdecl; td; td = td.overnext) |
60bb0fe4563e
dmdfe 2.037 first main iteration
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
128
diff
changeset
|
769 { |
60bb0fe4563e
dmdfe 2.037 first main iteration
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
128
diff
changeset
|
770 /* If any of the overloaded template declarations need inference, |
60bb0fe4563e
dmdfe 2.037 first main iteration
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
128
diff
changeset
|
771 * then return TRUE |
60bb0fe4563e
dmdfe 2.037 first main iteration
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
128
diff
changeset
|
772 */ |
60bb0fe4563e
dmdfe 2.037 first main iteration
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
128
diff
changeset
|
773 FuncDeclaration fd; |
60bb0fe4563e
dmdfe 2.037 first main iteration
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
128
diff
changeset
|
774 if (!td.onemember || |
131
206db751bd4c
dmdfe 2.037 compiles now
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
130
diff
changeset
|
775 (fd = td.onemember.toAlias().isFuncDeclaration()) is null || |
130
60bb0fe4563e
dmdfe 2.037 first main iteration
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
128
diff
changeset
|
776 fd.type.ty != TY.Tfunction) |
60bb0fe4563e
dmdfe 2.037 first main iteration
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
128
diff
changeset
|
777 { |
60bb0fe4563e
dmdfe 2.037 first main iteration
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
128
diff
changeset
|
778 /* Not a template function, therefore type inference is not possible. |
60bb0fe4563e
dmdfe 2.037 first main iteration
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
128
diff
changeset
|
779 */ |
60bb0fe4563e
dmdfe 2.037 first main iteration
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
128
diff
changeset
|
780 //printf("false\n"); |
60bb0fe4563e
dmdfe 2.037 first main iteration
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
128
diff
changeset
|
781 return false; |
60bb0fe4563e
dmdfe 2.037 first main iteration
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
128
diff
changeset
|
782 } |
60bb0fe4563e
dmdfe 2.037 first main iteration
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
128
diff
changeset
|
783 |
60bb0fe4563e
dmdfe 2.037 first main iteration
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
128
diff
changeset
|
784 /* Determine if the instance arguments, tiargs, are all that is necessary |
60bb0fe4563e
dmdfe 2.037 first main iteration
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
128
diff
changeset
|
785 * to instantiate the template. |
60bb0fe4563e
dmdfe 2.037 first main iteration
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
128
diff
changeset
|
786 */ |
60bb0fe4563e
dmdfe 2.037 first main iteration
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
128
diff
changeset
|
787 TemplateTupleParameter tp = td.isVariadic(); |
60bb0fe4563e
dmdfe 2.037 first main iteration
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
128
diff
changeset
|
788 //printf("tp = %p, td->parameters->dim = %d, tiargs->dim = %d\n", tp, td->parameters->dim, tiargs->dim); |
60bb0fe4563e
dmdfe 2.037 first main iteration
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
128
diff
changeset
|
789 TypeFunction fdtype = cast(TypeFunction)fd.type; |
60bb0fe4563e
dmdfe 2.037 first main iteration
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
128
diff
changeset
|
790 if (Parameter.dim(fdtype.parameters) && |
60bb0fe4563e
dmdfe 2.037 first main iteration
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
128
diff
changeset
|
791 (tp || tiargs.dim < td.parameters.dim)) |
60bb0fe4563e
dmdfe 2.037 first main iteration
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
128
diff
changeset
|
792 return true; |
60bb0fe4563e
dmdfe 2.037 first main iteration
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
128
diff
changeset
|
793 } |
60bb0fe4563e
dmdfe 2.037 first main iteration
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
128
diff
changeset
|
794 //printf("false\n"); |
60bb0fe4563e
dmdfe 2.037 first main iteration
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
128
diff
changeset
|
795 return false; |
60bb0fe4563e
dmdfe 2.037 first main iteration
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
128
diff
changeset
|
796 } |
60bb0fe4563e
dmdfe 2.037 first main iteration
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
128
diff
changeset
|
797 |
72 | 798 override string toChars() |
0 | 799 { |
800 scope OutBuffer buf = new OutBuffer(); | |
801 HdrGenState hgs; | |
802 | |
803 toCBuffer(buf, &hgs); | |
804 return buf.extractString(); | |
805 } | |
806 | |
72 | 807 override string mangle() |
0 | 808 { |
20
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
809 OutBuffer buf = new OutBuffer(); |
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
810 string id; |
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
811 |
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
812 static if (0) { |
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
813 printf("TemplateInstance.mangle() %s", toChars()); |
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
814 if (parent) |
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
815 printf(" parent = %s %s", parent.kind(), parent.toChars()); |
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
816 printf("\n"); |
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
817 } |
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
818 id = ident ? ident.toChars() : toChars(); |
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
819 if (!tempdecl) |
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
820 error("is not defined"); |
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
821 else if (tempdecl.parent) |
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
822 { |
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
823 string p = tempdecl.parent.mangle(); |
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
824 if (p[0] == '_' && p[1] == 'D') |
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
825 p = p[2..$]; |
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
826 buf.writestring(p); |
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
827 } |
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
828 buf.printf("%d%s", id.length, id); |
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
829 id = buf.toChars(); |
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
830 buf.data = null; |
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
831 //printf("TemplateInstance.mangle() %s = %s\n", toChars(), id); |
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
832 return id; |
0 | 833 } |
834 | |
835 void printInstantiationTrace() | |
836 { | |
20
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
837 if (global.gag) |
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
838 return; |
0 | 839 } |
840 | |
72 | 841 override void toObjFile(int multiobj) // compile to .obj file |
0 | 842 { |
843 version (LOG) { | |
844 printf("TemplateInstance.toObjFile('%s', this = %p)\n", toChars(), this); | |
845 } | |
846 if (!errors && members) | |
847 { | |
848 if (multiobj) | |
849 // Append to list of object files to be written later | |
850 obj_append(this); | |
851 else | |
852 { | |
77
ad4792a1cfd6
more D-ification container accessing
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
74
diff
changeset
|
853 foreach(Dsymbol s; members) |
0 | 854 s.toObjFile(multiobj); |
855 } | |
856 } | |
857 } | |
858 | |
859 // Internal | |
860 /********************************** | |
861 * Input: | |
862 * flags 1: replace const variables with their initializers | |
863 */ | |
864 static void semanticTiargs(Loc loc, Scope sc, Objects tiargs, int flags) | |
865 { | |
866 // Run semantic on each argument, place results in tiargs[] | |
867 //printf("+TemplateInstance.semanticTiargs() %s\n", toChars()); | |
868 if (!tiargs) | |
869 return; | |
870 for (size_t j = 0; j < tiargs.dim; j++) | |
871 { | |
113
3482c73a991b
More cleanup for arrays
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
110
diff
changeset
|
872 Object o = tiargs[j]; |
0 | 873 Type ta = isType(o); |
874 Expression ea = isExpression(o); | |
875 Dsymbol sa = isDsymbol(o); | |
876 | |
877 //printf("1: tiargs.data[%d] = %p, %p, %p, ea=%p, ta=%p\n", j, o, isDsymbol(o), isTuple(o), ea, ta); | |
878 if (ta) | |
879 { | |
880 //printf("type %s\n", ta.toChars()); | |
881 // It might really be an Expression or an Alias | |
882 ta.resolve(loc, sc, &ea, &ta, &sa); | |
883 if (ea) | |
884 { | |
885 ea = ea.semantic(sc); | |
886 /* This test is to skip substituting a const var with | |
887 * its initializer. The problem is the initializer won't | |
888 * match with an 'alias' parameter. Instead, do the | |
889 * const substitution in TemplateValueParameter.matchArg(). | |
890 */ | |
891 if (ea.op != TOKvar || flags & 1) | |
892 ea = ea.optimize(WANTvalue | WANTinterpret); | |
893 | |
94
3a0b150c9841
Objects -> Vector!Object iteration 1
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
91
diff
changeset
|
894 tiargs[j] = ea; |
0 | 895 } |
896 else if (sa) | |
897 { | |
94
3a0b150c9841
Objects -> Vector!Object iteration 1
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
91
diff
changeset
|
898 tiargs[j] = sa; |
0 | 899 TupleDeclaration d = sa.toAlias().isTupleDeclaration(); |
900 if (d) | |
901 { | |
902 size_t dim = d.objects.dim; | |
903 tiargs.remove(j); | |
904 tiargs.insert(j, d.objects); | |
905 j--; | |
906 } | |
907 } | |
908 else if (ta) | |
909 { | |
910 Ltype: | |
911 if (ta.ty == Ttuple) | |
912 { | |
913 // Expand tuple | |
126
1765f3ef917d
ClassDeclarations, Arguments -> Vector
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
121
diff
changeset
|
914 auto tt = cast(TypeTuple)ta; |
0 | 915 size_t dim = tt.arguments.dim; |
916 tiargs.remove(j); | |
917 if (dim) | |
918 { | |
919 tiargs.reserve(dim); | |
920 for (size_t i = 0; i < dim; i++) | |
921 { | |
126
1765f3ef917d
ClassDeclarations, Arguments -> Vector
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
121
diff
changeset
|
922 auto arg = tt.arguments[i]; |
94
3a0b150c9841
Objects -> Vector!Object iteration 1
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
91
diff
changeset
|
923 tiargs.insert(j + i, arg.type); |
0 | 924 } |
925 } | |
926 j--; | |
927 } | |
928 else | |
94
3a0b150c9841
Objects -> Vector!Object iteration 1
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
91
diff
changeset
|
929 tiargs[j] = ta; |
0 | 930 } |
931 else | |
932 { | |
933 assert(global.errors); | |
94
3a0b150c9841
Objects -> Vector!Object iteration 1
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
91
diff
changeset
|
934 tiargs[j] = Type.terror; |
0 | 935 } |
936 } | |
937 else if (ea) | |
938 { | |
939 if (!ea) | |
940 { | |
941 assert(global.errors); | |
942 ea = new IntegerExp(0); | |
943 } | |
944 assert(ea); | |
945 ea = ea.semantic(sc); | |
946 if (ea.op != TOKvar || flags & 1) | |
947 ea = ea.optimize(WANTvalue | WANTinterpret); | |
94
3a0b150c9841
Objects -> Vector!Object iteration 1
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
91
diff
changeset
|
948 tiargs[j] = ea; |
0 | 949 if (ea.op == TOKtype) |
950 { | |
951 ta = ea.type; | |
952 goto Ltype; | |
953 } | |
954 if (ea.op == TOKtuple) | |
955 { | |
956 // Expand tuple | |
90
39648eb578f6
more Expressions work
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
84
diff
changeset
|
957 auto te = cast(TupleExp)ea; |
0 | 958 size_t dim = te.exps.dim; |
959 tiargs.remove(j); | |
960 if (dim) | |
961 { | |
962 tiargs.reserve(dim); | |
963 for (size_t i = 0; i < dim; i++) | |
94
3a0b150c9841
Objects -> Vector!Object iteration 1
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
91
diff
changeset
|
964 tiargs.insert(j + i, te.exps[i]); |
0 | 965 } |
966 j--; | |
967 } | |
968 } | |
969 else if (sa) | |
970 { | |
971 TemplateDeclaration td = sa.isTemplateDeclaration(); | |
972 if (td && !td.semanticRun && td.literal) | |
973 td.semantic(sc); | |
974 } | |
975 else | |
976 { | |
977 assert(0); | |
978 } | |
979 //printf("1: tiargs.data[%d] = %p\n", j, tiargs.data[j]); | |
980 } | |
981 | |
982 static if (false) { | |
983 printf("-TemplateInstance.semanticTiargs('%s', this=%p)\n", toChars(), this); | |
984 for (size_t j = 0; j < tiargs.dim; j++) | |
985 { | |
986 Object o = cast(Object)tiargs.data[j]; | |
987 Type ta = isType(o); | |
988 Expression ea = isExpression(o); | |
989 Dsymbol sa = isDsymbol(o); | |
990 Tuple va = isTuple(o); | |
991 | |
992 printf("\ttiargs[%d] = ta %p, ea %p, sa %p, va %p\n", j, ta, ea, sa, va); | |
993 } | |
994 } | |
995 } | |
996 | |
997 void semanticTiargs(Scope sc) | |
998 { | |
999 //printf("+TemplateInstance.semanticTiargs() %s\n", toChars()); | |
1000 if (semantictiargsdone) | |
1001 return; | |
1002 | |
1003 semantictiargsdone = 1; | |
1004 semanticTiargs(loc, sc, tiargs, 0); | |
1005 } | |
1006 | |
1007 /********************************************** | |
1008 * Find template declaration corresponding to template instance. | |
1009 */ | |
1010 TemplateDeclaration findTemplateDeclaration(Scope sc) | |
1011 { | |
1012 //printf("TemplateInstance.findTemplateDeclaration() %s\n", toChars()); | |
1013 if (!tempdecl) | |
1014 { | |
1015 /* Given: | |
1016 * foo!( ... ) | |
1017 * figure out which TemplateDeclaration foo refers to. | |
1018 */ | |
1019 Dsymbol s; | |
1020 Dsymbol scopesym; | |
1021 int i; | |
1022 | |
1023 Identifier id = name; | |
1024 s = sc.search(loc, id, &scopesym); | |
1025 if (!s) | |
1026 { | |
1027 error("identifier '%s' is not defined", id.toChars()); | |
1028 return null; | |
1029 } | |
1030 version (LOG) { | |
1031 printf("It's an instance of '%s' kind '%s'\n", s.toChars(), s.kind()); | |
1032 if (s.parent) | |
1033 printf("s.parent = '%s'\n", s.parent.toChars()); | |
1034 } | |
1035 withsym = scopesym.isWithScopeSymbol(); | |
1036 | |
1037 /* We might have found an alias within a template when | |
1038 * we really want the template. | |
1039 */ | |
1040 TemplateInstance ti; | |
1041 if (s.parent && | |
1042 (ti = s.parent.isTemplateInstance()) !is null) | |
1043 { | |
1044 if ( | |
1045 (ti.name == id || | |
1046 ti.toAlias().ident == id) | |
1047 && | |
1048 ti.tempdecl | |
1049 ) | |
1050 { | |
1051 /* This is so that one can refer to the enclosing | |
1052 * template, even if it has the same name as a member | |
1053 * of the template, if it has a !(arguments) | |
1054 */ | |
1055 tempdecl = ti.tempdecl; | |
1056 if (tempdecl.overroot) // if not start of overloaded list of TemplateDeclaration's | |
1057 tempdecl = tempdecl.overroot; // then get the start | |
1058 | |
1059 s = tempdecl; | |
1060 } | |
1061 } | |
1062 | |
1063 s = s.toAlias(); | |
1064 | |
1065 /* It should be a TemplateDeclaration, not some other symbol | |
1066 */ | |
1067 tempdecl = s.isTemplateDeclaration(); | |
1068 if (!tempdecl) | |
1069 { | |
1070 if (!s.parent && global.errors) | |
1071 return null; | |
1072 if (!s.parent && s.getType()) | |
1073 { | |
1074 Dsymbol s2 = s.getType().toDsymbol(sc); | |
1075 if (!s2) | |
1076 { | |
1077 error("%s is not a template declaration, it is a %s", id.toChars(), s.kind()); | |
1078 return null; | |
1079 } | |
1080 s = s2; | |
1081 } | |
1082 debug { | |
1083 //if (!s.parent) printf("s = %s %s\n", s.kind(), s.toChars()); | |
1084 } | |
1085 //assert(s.parent); | |
1086 TemplateInstance ti2 = s.parent ? s.parent.isTemplateInstance() : null; | |
1087 if (ti2 && | |
1088 (ti2.name == id || | |
1089 ti2.toAlias().ident == id) | |
1090 && | |
1091 ti2.tempdecl | |
1092 ) | |
1093 { | |
1094 /* This is so that one can refer to the enclosing | |
1095 * template, even if it has the same name as a member | |
1096 * of the template, if it has a !(arguments) | |
1097 */ | |
1098 tempdecl = ti2.tempdecl; | |
1099 if (tempdecl.overroot) // if not start of overloaded list of TemplateDeclaration's | |
1100 tempdecl = tempdecl.overroot; // then get the start | |
1101 } | |
1102 else | |
1103 { | |
1104 error("%s is not a template declaration, it is a %s", id.toChars(), s.kind()); | |
1105 return null; | |
1106 } | |
1107 } | |
1108 } | |
1109 else | |
1110 assert(tempdecl.isTemplateDeclaration()); | |
1111 | |
1112 return tempdecl; | |
1113 } | |
1114 | |
1115 TemplateDeclaration findBestMatch(Scope sc) | |
1116 { | |
1117 /* Since there can be multiple TemplateDeclaration's with the same | |
1118 * name, look for the best match. | |
1119 */ | |
1120 TemplateDeclaration td_ambig = null; | |
1121 TemplateDeclaration td_best = null; | |
1122 MATCH m_best = MATCHnomatch; | |
1123 scope Objects dedtypes = new Objects(); | |
1124 | |
1125 version (LOG) { | |
1126 printf("TemplateInstance.findBestMatch()\n"); | |
1127 } | |
1128 // First look for forward references | |
1129 for (TemplateDeclaration td = tempdecl; td; td = td.overnext) | |
1130 { | |
1131 if (!td.semanticRun) | |
1132 { | |
1133 if (td.scope_) | |
1134 { | |
1135 // Try to fix forward reference | |
1136 td.semantic(td.scope_); | |
1137 } | |
1138 if (!td.semanticRun) | |
1139 { | |
1140 error("%s forward references template declaration %s\n", toChars(), td.toChars()); | |
1141 return null; | |
1142 } | |
1143 } | |
1144 } | |
1145 | |
1146 for (TemplateDeclaration td = tempdecl; td; td = td.overnext) | |
1147 { | |
1148 MATCH m; | |
1149 | |
1150 //if (tiargs.dim) printf("2: tiargs.dim = %d, data[0] = %p\n", tiargs.dim, tiargs.data[0]); | |
1151 | |
1152 // If more arguments than parameters, | |
1153 // then this is no match. | |
1154 if (td.parameters.dim < tiargs.dim) | |
1155 { | |
1156 if (!td.isVariadic()) | |
1157 continue; | |
1158 } | |
1159 | |
1160 dedtypes.setDim(td.parameters.dim); | |
1161 dedtypes.zero(); | |
1162 assert(td.semanticRun); | |
1163 m = td.matchWithInstance(this, dedtypes, 0); | |
1164 //printf("matchWithInstance = %d\n", m); | |
1165 if (!m) // no match at all | |
1166 continue; | |
1167 | |
1168 if (m < m_best) | |
1169 goto Ltd_best; | |
1170 if (m > m_best) | |
1171 goto Ltd; | |
1172 | |
1173 { | |
1174 // Disambiguate by picking the most specialized TemplateDeclaration | |
1175 MATCH c1 = td.leastAsSpecialized(td_best); | |
1176 MATCH c2 = td_best.leastAsSpecialized(td); | |
1177 //printf("c1 = %d, c2 = %d\n", c1, c2); | |
1178 | |
1179 if (c1 > c2) | |
1180 goto Ltd; | |
1181 else if (c1 < c2) | |
1182 goto Ltd_best; | |
1183 else | |
1184 goto Lambig; | |
1185 } | |
1186 | |
1187 Lambig: // td_best and td are ambiguous | |
1188 td_ambig = td; | |
1189 continue; | |
1190 | |
1191 Ltd_best: // td_best is the best match so far | |
1192 td_ambig = null; | |
1193 continue; | |
1194 | |
1195 Ltd: // td is the new best match | |
1196 td_ambig = null; | |
1197 td_best = td; | |
1198 m_best = m; | |
1199 tdtypes.setDim(dedtypes.dim); | |
113
3482c73a991b
More cleanup for arrays
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
110
diff
changeset
|
1200 memcpy(tdtypes.ptr, dedtypes.ptr, tdtypes.dim * (void*).sizeof); |
0 | 1201 continue; |
1202 } | |
1203 | |
1204 if (!td_best) | |
1205 { | |
1206 if (tempdecl && !tempdecl.overnext) | |
1207 // Only one template, so we can give better error message | |
1208 error("%s does not match template declaration %s", toChars(), tempdecl.toChars()); | |
1209 else | |
1210 error("%s does not match any template declaration", toChars()); | |
1211 return null; | |
1212 } | |
1213 | |
1214 if (td_ambig) | |
1215 { | |
1216 error("%s matches more than one template declaration, %s and %s", | |
1217 toChars(), td_best.toChars(), td_ambig.toChars()); | |
1218 } | |
1219 | |
1220 /* The best match is td_best | |
1221 */ | |
1222 tempdecl = td_best; | |
1223 | |
1224 static if (false) { | |
1225 /* Cast any value arguments to be same type as value parameter | |
1226 */ | |
1227 for (size_t i = 0; i < tiargs.dim; i++) | |
1228 { | |
1229 Object o = cast(Object)tiargs.data[i]; | |
1230 Expression ea = isExpression(o); // value argument | |
1231 TemplateParameter tp = cast(TemplateParameter)tempdecl.parameters.data[i]; | |
1232 assert(tp); | |
1233 TemplateValueParameter tvp = tp.isTemplateValueParameter(); | |
1234 if (tvp) | |
1235 { | |
1236 assert(ea); | |
1237 ea = ea.castTo(tvp.valType); | |
1238 ea = ea.optimize(WANTvalue | WANTinterpret); | |
1239 tiargs.data[i] = cast(Object)ea; | |
1240 } | |
1241 } | |
1242 } | |
1243 | |
1244 version (LOG) { | |
1245 printf("\tIt's a match with template declaration '%s'\n", tempdecl.toChars()); | |
1246 } | |
1247 return tempdecl; | |
1248 } | |
1249 | |
1250 /**************************************************** | |
1251 * Declare parameters of template instance, initialize them with the | |
1252 * template instance arguments. | |
1253 */ | |
1254 void declareParameters(Scope sc) | |
1255 { | |
20
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
1256 //printf("TemplateInstance.declareParameters()\n"); |
0 | 1257 for (int i = 0; i < tdtypes.dim; i++) |
1258 { | |
121
347de076ad34
TemplateParameters -> Vector
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
114
diff
changeset
|
1259 auto tp = tempdecl.parameters[i]; |
0 | 1260 //Object o = cast(Object)tiargs.data[i]; |
113
3482c73a991b
More cleanup for arrays
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
110
diff
changeset
|
1261 Object o = tdtypes[i]; // initializer for tp |
0 | 1262 |
1263 //printf("\ttdtypes[%d] = %p\n", i, o); | |
1264 tempdecl.declareParameter(sc, tp, o); | |
1265 } | |
1266 } | |
1267 | |
1268 /***************************************** | |
1269 * Determines if a TemplateInstance will need a nested | |
1270 * generation of the TemplateDeclaration. | |
1271 */ | |
1272 bool hasNestedArgs(Objects args) | |
1273 { | |
1274 bool nested = false; | |
20
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
1275 //printf("TemplateInstance.hasNestedArgs('%s')\n", tempdecl.ident.toChars()); |
0 | 1276 |
1277 /* A nested instance happens when an argument references a local | |
1278 * symbol that is on the stack. | |
1279 */ | |
1280 for (size_t i = 0; i < args.dim; i++) | |
1281 { | |
113
3482c73a991b
More cleanup for arrays
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
110
diff
changeset
|
1282 Object o = args[i]; |
0 | 1283 Expression ea = isExpression(o); |
1284 Dsymbol sa = isDsymbol(o); | |
1285 Tuple va = isTuple(o); | |
1286 if (ea) | |
1287 { | |
1288 if (ea.op == TOKvar) | |
1289 { | |
1290 sa = (cast(VarExp)ea).var; | |
1291 goto Lsa; | |
1292 } | |
1293 if (ea.op == TOKfunction) | |
1294 { | |
1295 sa = (cast(FuncExp)ea).fd; | |
1296 goto Lsa; | |
1297 } | |
1298 } | |
1299 else if (sa) | |
1300 { | |
1301 Lsa: | |
1302 TemplateDeclaration td = sa.isTemplateDeclaration(); | |
96 | 1303 Declaration d = sa.isDeclaration(); |
1304 if ((td && td.literal) || | |
1305 (d && !d.isDataseg() && | |
1306 | |
1307 /// version (DMDV2) { // TODO: | |
0 | 1308 !(d.storage_class & STCmanifest) && |
1309 /// } | |
1310 (!d.isFuncDeclaration() || d.isFuncDeclaration().isNested()) && | |
96 | 1311 !isTemplateMixin() |
1312 )) | |
0 | 1313 { |
1314 // if module level template | |
1315 if (tempdecl.toParent().isModule()) | |
1316 { | |
1317 Dsymbol dparent = sa.toParent(); | |
1318 if (!isnested) | |
1319 isnested = dparent; | |
1320 else if (isnested != dparent) | |
1321 { | |
1322 /* Select the more deeply nested of the two. | |
1323 * Error if one is not nested inside the other. | |
1324 */ | |
1325 for (Dsymbol p = isnested; p; p = p.parent) | |
1326 { | |
1327 if (p == dparent) | |
1328 goto L1; // isnested is most nested | |
1329 } | |
1330 for (Dsymbol p = dparent; p; p = p.parent) | |
1331 { | |
1332 if (p == isnested) | |
1333 { | |
1334 isnested = dparent; | |
1335 goto L1; // dparent is most nested | |
1336 } | |
1337 } | |
1338 error("%s is nested in both %s and %s", | |
1339 toChars(), isnested.toChars(), dparent.toChars()); | |
1340 } | |
1341 L1: | |
1342 //printf("\tnested inside %s\n", isnested.toChars()); | |
1343 nested |= 1; | |
1344 } | |
1345 else | |
1346 error("cannot use local '%s' as parameter to non-global template %s", d.toChars(), tempdecl.toChars()); | |
1347 } | |
1348 } | |
1349 else if (va) | |
1350 { | |
1351 nested |= hasNestedArgs(va.objects); | |
1352 } | |
1353 } | |
1354 return nested; | |
1355 } | |
1356 | |
1357 /**************************************** | |
1358 * This instance needs an identifier for name mangling purposes. | |
1359 * Create one by taking the template declaration name and adding | |
1360 * the type signature for it. | |
1361 */ | |
1362 Identifier genIdent() | |
1363 { | |
1364 scope OutBuffer buf = new OutBuffer(); | |
1365 | |
20
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
1366 //printf("TemplateInstance.genIdent('%s')\n", tempdecl.ident.toChars()); |
96 | 1367 string id = tempdecl.ident.toChars(); |
0 | 1368 buf.printf("__T%d%s", id.length, id); ///! |
96 | 1369 Objects args = tiargs; |
0 | 1370 for (int i = 0; i < args.dim; i++) |
1371 { | |
113
3482c73a991b
More cleanup for arrays
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
110
diff
changeset
|
1372 Object o = args[i]; |
0 | 1373 Type ta = isType(o); |
1374 Expression ea = isExpression(o); | |
1375 Dsymbol sa = isDsymbol(o); | |
1376 Tuple va = isTuple(o); | |
1377 //printf("\to [%d] %p ta %p ea %p sa %p va %p\n", i, o, ta, ea, sa, va); | |
1378 if (ta) | |
1379 { | |
1380 buf.writeByte('T'); | |
1381 if (ta.deco) | |
1382 buf.writestring(ta.deco); | |
1383 else | |
1384 { | |
1385 debug writef("ta = %d, %s\n", ta.ty, ta.toChars()); | |
1386 assert(global.errors); | |
1387 } | |
1388 } | |
1389 else if (ea) | |
1390 { | |
1391 Lea: | |
1392 long v; | |
1393 real r; | |
1394 | |
1395 ea = ea.optimize(WANTvalue | WANTinterpret); | |
1396 if (ea.op == TOKvar) | |
1397 { | |
1398 sa = (cast(VarExp)ea).var; | |
1399 ea = null; | |
1400 goto Lsa; | |
1401 } | |
1402 if (ea.op == TOKfunction) | |
1403 { | |
1404 sa = (cast(FuncExp)ea).fd; | |
1405 ea = null; | |
1406 goto Lsa; | |
1407 } | |
1408 buf.writeByte('V'); | |
1409 if (ea.op == TOKtuple) | |
1410 { | |
1411 ea.error("tuple is not a valid template value argument"); | |
1412 continue; | |
1413 } | |
1414 static if (true) { | |
1415 /* Use deco that matches what it would be for a function parameter | |
1416 */ | |
1417 buf.writestring(ea.type.deco); | |
1418 } else { | |
1419 // Use type of parameter, not type of argument | |
1420 TemplateParameter tp = cast(TemplateParameter)tempdecl.parameters.data[i]; | |
1421 assert(tp); | |
1422 TemplateValueParameter tvp = tp.isTemplateValueParameter(); | |
1423 assert(tvp); | |
1424 buf.writestring(tvp.valType.deco); | |
1425 } | |
1426 ea.toMangleBuffer(buf); | |
1427 } | |
1428 else if (sa) | |
1429 { | |
1430 Lsa: | |
1431 buf.writeByte('S'); | |
1432 Declaration d = sa.isDeclaration(); | |
1433 if (d && (!d.type || !d.type.deco)) | |
1434 { | |
1435 error("forward reference of %s", d.toChars()); | |
1436 continue; | |
1437 } | |
1438 static if (false) { | |
1439 VarDeclaration v = sa.isVarDeclaration(); | |
1440 if (v && v.storage_class & STCmanifest) | |
1441 { | |
1442 ExpInitializer ei = v.init.isExpInitializer(); | |
1443 if (ei) | |
1444 { | |
1445 ea = ei.exp; | |
1446 goto Lea; | |
1447 } | |
1448 } | |
1449 } | |
1450 string p = sa.mangle(); | |
62 | 1451 ///buf.printf("%zu%s", p.length, p); |
1452 buf.printf("%su%s", p.length, p); | |
0 | 1453 } |
1454 else if (va) | |
1455 { | |
1456 assert(i + 1 == args.dim); // must be last one | |
1457 args = va.objects; | |
1458 i = -1; | |
1459 } | |
1460 else | |
1461 assert(0); | |
1462 } | |
1463 buf.writeByte('Z'); | |
1464 id = buf.toChars(); | |
1465 buf.data = null; | |
1466 //printf("\tgenIdent = %s\n", id); | |
1467 return new Identifier(id, TOKidentifier); | |
1468 } | |
1469 | |
72 | 1470 override TemplateInstance isTemplateInstance() { return this; } |
0 | 1471 |
72 | 1472 override AliasDeclaration isAliasDeclaration() |
0 | 1473 { |
1474 assert(false); | |
1475 } | |
20
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
1476 } |