comparison dmd/TypeSArray.d @ 110:12c0c84d13fd

merged in 2.036 changes
author Trass3r
date Tue, 31 Aug 2010 22:29:00 +0200
parents acd69f84627e 3a0b150c9841
children 3482c73a991b
comparison
equal deleted inserted replaced
109:ceda59b4d255 110:12c0c84d13fd
270 /* Create a new TupleDeclaration which 270 /* Create a new TupleDeclaration which
271 * is a slice [d..d+1] out of the old one. 271 * is a slice [d..d+1] out of the old one.
272 * Do it this way because TemplateInstance.semanticTiargs() 272 * Do it this way because TemplateInstance.semanticTiargs()
273 * can handle unresolved Objects this way. 273 * can handle unresolved Objects this way.
274 */ 274 */
275 Objects objects = new Objects; 275 auto objects = new Objects;
276 objects.setDim(1); 276 objects.setDim(1);
277 objects.data[0] = cast(void*)o; 277 objects[0] = o;
278 278
279 TupleDeclaration tds = new TupleDeclaration(loc, td.ident, objects); 279 auto tds = new TupleDeclaration(loc, td.ident, objects);
280 *ps = tds; 280 *ps = tds;
281 } 281 }
282 else 282 else
283 goto Ldefault; 283 goto Ldefault;
284 } 284 }
521 { 521 {
522 Type vt = tvp.valType.semantic(Loc(0), sc); 522 Type vt = tvp.valType.semantic(Loc(0), sc);
523 MATCH m = cast(MATCH)dim.implicitConvTo(vt); 523 MATCH m = cast(MATCH)dim.implicitConvTo(vt);
524 if (!m) 524 if (!m)
525 goto Lnomatch; 525 goto Lnomatch;
526 dedtypes.data[i] = cast(void*)dim; 526 dedtypes[i] = dim;
527 } 527 }
528 } 528 }
529 else if (dim.toInteger() != tp.dim.toInteger()) 529 else if (dim.toInteger() != tp.dim.toInteger())
530 return MATCHnomatch; 530 return MATCHnomatch;
531 } 531 }
532 else if (tparam.ty == Taarray) 532 else if (tparam.ty == Taarray)
533 { 533 {
534 TypeAArray tp = cast(TypeAArray)tparam; 534 auto tp = cast(TypeAArray)tparam;
535 if (tp.index.ty == Tident) 535 if (tp.index.ty == Tident)
536 { 536 {
537 TypeIdentifier tident = cast(TypeIdentifier)tp.index; 537 auto tident = cast(TypeIdentifier)tp.index;
538 538
539 if (tident.idents.dim == 0) 539 if (tident.idents.dim == 0)
540 { 540 {
541 Identifier id = tident.ident; 541 Identifier id = tident.ident;
542 542
543 for (size_t i = 0; i < parameters.dim; i++) 543 for (size_t i = 0; i < parameters.dim; i++)
544 { 544 {
545 TemplateParameter tp2 = cast(TemplateParameter)parameters.data[i]; 545 auto tp2 = cast(TemplateParameter)parameters.data[i];
546 546
547 if (tp2.ident.equals(id)) 547 if (tp2.ident.equals(id))
548 { 548 {
549 // Found the corresponding template parameter 549 // Found the corresponding template parameter
550 TemplateValueParameter tvp = tp2.isTemplateValueParameter(); 550 TemplateValueParameter tvp = tp2.isTemplateValueParameter();
555 { 555 {
556 if (!dim.equals(cast(Object)dedtypes.data[i])) 556 if (!dim.equals(cast(Object)dedtypes.data[i]))
557 goto Lnomatch; 557 goto Lnomatch;
558 } 558 }
559 else 559 else
560 { dedtypes.data[i] = cast(void*)dim; 560 { dedtypes[i] = dim;
561 } 561 }
562 return next.deduceType(sc, tparam.nextOf(), parameters, dedtypes); 562 return next.deduceType(sc, tparam.nextOf(), parameters, dedtypes);
563 } 563 }
564 } 564 }
565 } 565 }