mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-01-14 03:43:13 +01:00
Fix array op argument evaluation order regression.
Fixes DMD testcase 'arrayop'.
This commit is contained in:
@@ -255,7 +255,10 @@ ArrayOp *buildArrayOp(Identifier *ident, BinExp *exp, Scope *sc, Loc loc)
|
||||
Parameters *fparams = new Parameters();
|
||||
Expression *loopbody = exp->buildArrayLoop(fparams);
|
||||
if (isDruntimeArrayOp(ident))
|
||||
{
|
||||
op->cFunc = FuncDeclaration::genCfunc(fparams, exp->type, ident);
|
||||
op->cFunc->isArrayOp = 2;
|
||||
}
|
||||
#else
|
||||
if (isDruntimeArrayOp(ident))
|
||||
op->cFunc = FuncDeclaration::genCfunc(exp->type, ident);
|
||||
|
||||
@@ -513,7 +513,10 @@ DValue* DtoCallFunction(Loc& loc, Type* resulttype, DValue* fnval, Expressions*
|
||||
std::vector<DValue*> argvals;
|
||||
argvals.reserve(n);
|
||||
if (dfnval && dfnval->func->isArrayOp) {
|
||||
// slightly different approach for array operators
|
||||
// For array ops, the druntime implementation signatures are crafted
|
||||
// specifically such that the evaluation order is as expected with
|
||||
// the strange DMD reverse parameter passing order. Thus, we need
|
||||
// to actually build the arguments right-to-left for them.
|
||||
for (int i=n-1; i>=0; --i) {
|
||||
Parameter* fnarg = Parameter::getNth(tf->parameters, i);
|
||||
assert(fnarg);
|
||||
|
||||
Reference in New Issue
Block a user