Mercurial > projects > ddmd
comparison dmd/ForeachStatement.d @ 84:be2ab491772e
Expressions -> Vector!Expression
author | Eldar Insafutdinov <e.insafutdinov@gmail.com> |
---|---|
date | Mon, 30 Aug 2010 16:12:19 +0100 |
parents | ef02e2e203c2 |
children | 39648eb578f6 |
comparison
equal
deleted
inserted
replaced
83:ee670dd808a8 | 84:be2ab491772e |
---|---|
622 fdapply = FuncDeclaration.genCfunc(Type.tindex, "_aaApply2"); | 622 fdapply = FuncDeclaration.genCfunc(Type.tindex, "_aaApply2"); |
623 else | 623 else |
624 fdapply = FuncDeclaration.genCfunc(Type.tindex, "_aaApply"); | 624 fdapply = FuncDeclaration.genCfunc(Type.tindex, "_aaApply"); |
625 | 625 |
626 ec = new VarExp(Loc(0), fdapply); | 626 ec = new VarExp(Loc(0), fdapply); |
627 Expressions exps = new Expressions(); | 627 auto exps = new Expressions(); |
628 exps.push(cast(void*)aggr); | 628 exps.push(aggr); |
629 size_t keysize = cast(uint)taa.index.size(); | 629 size_t keysize = cast(uint)taa.index.size(); |
630 keysize = (keysize + (PTRSIZE-1)) & ~(PTRSIZE-1); | 630 keysize = (keysize + (PTRSIZE-1)) & ~(PTRSIZE-1); |
631 exps.push(cast(void*)new IntegerExp(Loc(0), keysize, Type.tsize_t)); | 631 exps.push(new IntegerExp(Loc(0), keysize, Type.tsize_t)); |
632 exps.push(cast(void*)flde); | 632 exps.push(flde); |
633 e = new CallExp(loc, ec, exps); | 633 e = new CallExp(loc, ec, exps); |
634 e.type = Type.tindex; // don't run semantic() on e | 634 e.type = Type.tindex; // don't run semantic() on e |
635 } | 635 } |
636 else if (tab.ty == TY.Tarray || tab.ty == TY.Tsarray) | 636 else if (tab.ty == TY.Tarray || tab.ty == TY.Tsarray) |
637 { | 637 { |
662 int j = sprintf(fdname.ptr, "_aApply%.*s%.*s%zd".ptr, r, 2, fntab[flag].ptr, dim); | 662 int j = sprintf(fdname.ptr, "_aApply%.*s%.*s%zd".ptr, r, 2, fntab[flag].ptr, dim); |
663 assert(j < fdname.sizeof); | 663 assert(j < fdname.sizeof); |
664 fdapply = FuncDeclaration.genCfunc(Type.tindex, fdname[0..j].idup); | 664 fdapply = FuncDeclaration.genCfunc(Type.tindex, fdname[0..j].idup); |
665 | 665 |
666 ec = new VarExp(Loc(0), fdapply); | 666 ec = new VarExp(Loc(0), fdapply); |
667 Expressions exps = new Expressions(); | 667 auto exps = new Expressions(); |
668 if (tab.ty == TY.Tsarray) | 668 if (tab.ty == TY.Tsarray) |
669 aggr = aggr.castTo(sc, tn.arrayOf()); | 669 aggr = aggr.castTo(sc, tn.arrayOf()); |
670 exps.push(cast(void*)aggr); | 670 exps.push(aggr); |
671 exps.push(cast(void*)flde); | 671 exps.push(flde); |
672 e = new CallExp(loc, ec, exps); | 672 e = new CallExp(loc, ec, exps); |
673 e.type = Type.tindex; // don't run semantic() on e | 673 e.type = Type.tindex; // don't run semantic() on e |
674 } | 674 } |
675 else if (tab.ty == TY.Tdelegate) | 675 else if (tab.ty == TY.Tdelegate) |
676 { | 676 { |
677 /* Call: | 677 /* Call: |
678 * aggr(flde) | 678 * aggr(flde) |
679 */ | 679 */ |
680 Expressions exps = new Expressions(); | 680 auto exps = new Expressions(); |
681 exps.push(cast(void*)flde); | 681 exps.push(flde); |
682 e = new CallExp(loc, aggr, exps); | 682 e = new CallExp(loc, aggr, exps); |
683 e = e.semantic(sc); | 683 e = e.semantic(sc); |
684 if (e.type != Type.tint32) | 684 if (e.type != Type.tint32) |
685 error("opApply() function for %s must return an int", tab.toChars()); | 685 error("opApply() function for %s must return an int", tab.toChars()); |
686 } | 686 } |
712 ec = new DotIdExp(loc, aggr, idapply); | 712 ec = new DotIdExp(loc, aggr, idapply); |
713 exps.push(cast(void*)flde); | 713 exps.push(cast(void*)flde); |
714 } | 714 } |
715 } else { | 715 } else { |
716 ec = new DotIdExp(loc, aggr, idapply); | 716 ec = new DotIdExp(loc, aggr, idapply); |
717 exps.push(cast(void*)flde); | 717 exps.push(flde); |
718 } | 718 } |
719 e = new CallExp(loc, ec, exps); | 719 e = new CallExp(loc, ec, exps); |
720 e = e.semantic(sc); | 720 e = e.semantic(sc); |
721 if (e.type != Type.tint32) { | 721 if (e.type != Type.tint32) { |
722 error("opApply() function for %s must return an int", tab.toChars()); | 722 error("opApply() function for %s must return an int", tab.toChars()); |