comparison dmd/TypeInstance.d @ 113:3482c73a991b

More cleanup for arrays
author Eldar Insafutdinov <e.insafutdinov@gmail.com>
date Tue, 31 Aug 2010 23:57:32 +0100
parents 3a0b150c9841
children e28b18c23469
comparison
equal deleted inserted replaced
112:3f02152c5e68 113:3482c73a991b
205 Object sa = tempinst.tempdecl; 205 Object sa = tempinst.tempdecl;
206 if (!sa) 206 if (!sa)
207 goto Lnomatch; 207 goto Lnomatch;
208 if (ta.specAlias && sa != ta.specAlias) 208 if (ta.specAlias && sa != ta.specAlias)
209 goto Lnomatch; 209 goto Lnomatch;
210 if (dedtypes.data[i]) 210 if (dedtypes[i])
211 { // Must match already deduced symbol 211 { // Must match already deduced symbol
212 Object s = cast(Object)dedtypes.data[i]; 212 Object s = dedtypes[i];
213 213
214 if (s != sa) 214 if (s != sa)
215 goto Lnomatch; 215 goto Lnomatch;
216 } 216 }
217 dedtypes[i] = sa; 217 dedtypes[i] = sa;
225 for (int i = 0; 1; i++) 225 for (int i = 0; 1; i++)
226 { 226 {
227 //printf("\ttest: tempinst->tiargs[%d]\n", i); 227 //printf("\ttest: tempinst->tiargs[%d]\n", i);
228 Object o1; 228 Object o1;
229 if (i < tempinst.tiargs.dim) 229 if (i < tempinst.tiargs.dim)
230 o1 = cast(Object)tempinst.tiargs.data[i]; 230 o1 = tempinst.tiargs[i];
231 else if (i < tempinst.tdtypes.dim && i < tp.tempinst.tiargs.dim) 231 else if (i < tempinst.tdtypes.dim && i < tp.tempinst.tiargs.dim)
232 // Pick up default arg 232 // Pick up default arg
233 o1 = cast(Object)tempinst.tdtypes.data[i]; 233 o1 = tempinst.tdtypes[i];
234 else 234 else
235 break; 235 break;
236 236
237 if (i >= tp.tempinst.tiargs.dim) 237 if (i >= tp.tempinst.tiargs.dim)
238 goto Lnomatch; 238 goto Lnomatch;
239 239
240 Object o2 = cast(Object)tp.tempinst.tiargs.data[i]; 240 Object o2 = tp.tempinst.tiargs[i];
241 241
242 Type t1 = isType(o1); 242 Type t1 = isType(o1);
243 Type t2 = isType(o2); 243 Type t2 = isType(o2);
244 244
245 Expression e1 = isExpression(o1); 245 Expression e1 = isExpression(o1);
327 TemplateParameter tp_ = cast(TemplateParameter)parameters.data[j]; 327 TemplateParameter tp_ = cast(TemplateParameter)parameters.data[j];
328 // BUG: use tp->matchArg() instead of the following 328 // BUG: use tp->matchArg() instead of the following
329 TemplateValueParameter tv = tp_.isTemplateValueParameter(); 329 TemplateValueParameter tv = tp_.isTemplateValueParameter();
330 if (!tv) 330 if (!tv)
331 goto Lnomatch; 331 goto Lnomatch;
332 Expression e = cast(Expression)dedtypes.data[j]; 332 Expression e = cast(Expression)dedtypes[j];
333 if (e) 333 if (e)
334 { 334 {
335 if (!e1.equals(e)) 335 if (!e1.equals(e))
336 goto Lnomatch; 336 goto Lnomatch;
337 } 337 }
351 TemplateParameter tp_ = cast(TemplateParameter)parameters.data[j]; 351 TemplateParameter tp_ = cast(TemplateParameter)parameters.data[j];
352 // BUG: use tp->matchArg() instead of the following 352 // BUG: use tp->matchArg() instead of the following
353 TemplateAliasParameter ta = tp_.isTemplateAliasParameter(); 353 TemplateAliasParameter ta = tp_.isTemplateAliasParameter();
354 if (!ta) 354 if (!ta)
355 goto Lnomatch; 355 goto Lnomatch;
356 Dsymbol s = cast(Dsymbol)dedtypes.data[j]; 356 auto s = cast(Dsymbol)dedtypes[j];
357 if (s) 357 if (s)
358 { 358 {
359 if (!s1.equals(s)) 359 if (!s1.equals(s))
360 goto Lnomatch; 360 goto Lnomatch;
361 } 361 }