Merged DMD commit f9e4f31dc0c925b9a3caac5578565a382a6512f3:

partial bugzilla 5117 [CTFE] Member function call with rather complex this: side effects ignored
This commit is contained in:
David Nadlinger
2011-04-22 18:27:46 +02:00
parent 6992a16220
commit 108e423d83
2 changed files with 4 additions and 2 deletions

View File

@@ -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)

View File

@@ -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;