mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-01-25 17:13:14 +01:00
Merged DMD commit f9e4f31dc0c925b9a3caac5578565a382a6512f3:
partial bugzilla 5117 [CTFE] Member function call with rather complex this: side effects ignored
This commit is contained in:
@@ -56,6 +56,7 @@ Expression *interpret_values(InterState *istate, Expression *earg, FuncDeclarati
|
||||
ArrayLiteralExp *createBlockDuplicatedArrayLiteral(Type *type, Expression *elem, size_t dim);
|
||||
Expression * resolveReferences(Expression *e, Expression *thisval, bool *isReference = NULL);
|
||||
Expression *getVarExp(Loc loc, InterState *istate, Declaration *d);
|
||||
VarDeclaration *findParentVar(Expression *e, Expression *thisval);
|
||||
|
||||
/*************************************
|
||||
* Attempt to interpret a function given the arguments.
|
||||
@@ -222,9 +223,9 @@ Expression *FuncDeclaration::interpret(InterState *istate, Expressions *argument
|
||||
}
|
||||
}
|
||||
// Don't restore the value of 'this' upon function return
|
||||
if (needThis() && thisarg->op == TOKvar && istate)
|
||||
if (needThis() && istate)
|
||||
{
|
||||
VarDeclaration *thisvar = ((VarExp *)(thisarg))->var->isVarDeclaration();
|
||||
VarDeclaration *thisvar = findParentVar(thisarg, istate->localThis);
|
||||
for (size_t i = 0; i < istate->vars.dim; i++)
|
||||
{ VarDeclaration *v = (VarDeclaration *)istate->vars.data[i];
|
||||
if (v == thisvar)
|
||||
|
||||
@@ -2413,6 +2413,7 @@ Type *TypeAArray::semantic(Loc loc, Scope *sc)
|
||||
switch (next->toBasetype()->ty)
|
||||
{
|
||||
case Tfunction:
|
||||
case Tvoid:
|
||||
case Tnone:
|
||||
error(loc, "can't have associative array of %s", next->toChars());
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user