DMD 2.032 Merge.

This commit is contained in:
Robert Clipsham
2009-09-08 10:07:56 +01:00
parent 8b6f11938a
commit 089e792258
38 changed files with 1732 additions and 586 deletions
+43 -1
View File
@@ -86,6 +86,8 @@ Expression *expandVar(int result, VarDeclaration *v)
e = ei->syntaxCopy();
e = e->semantic(v->scope);
e = e->implicitCastTo(v->scope, v->type);
// enabling this line causes test22 in test suite to fail
//ei->type = e->type;
v->scope = NULL;
v->inuse--;
}
@@ -426,11 +428,50 @@ Expression *DotVarExp::optimize(int result)
return this;
}
Expression *NewExp::optimize(int result)
{
if (thisexp)
thisexp = thisexp->optimize(WANTvalue);
// Optimize parameters
if (newargs)
{
for (size_t i = 0; i < newargs->dim; i++)
{ Expression *e = (Expression *)newargs->data[i];
e = e->optimize(WANTvalue);
newargs->data[i] = (void *)e;
}
}
if (arguments)
{
for (size_t i = 0; i < arguments->dim; i++)
{ Expression *e = (Expression *)arguments->data[i];
e = e->optimize(WANTvalue);
arguments->data[i] = (void *)e;
}
}
return this;
}
Expression *CallExp::optimize(int result)
{
//printf("CallExp::optimize(result = %d) %s\n", result, toChars());
Expression *e = this;
// Optimize parameters
if (arguments)
{
for (size_t i = 0; i < arguments->dim; i++)
{ Expression *e = (Expression *)arguments->data[i];
e = e->optimize(WANTvalue);
arguments->data[i] = (void *)e;
}
}
e1 = e1->optimize(result);
if (e1->op == TOKvar)
{
@@ -792,7 +833,8 @@ Expression *IdentityExp::optimize(int result)
e2 = e2->optimize(WANTvalue | (result & WANTinterpret));
e = this;
if (this->e1->isConst() && this->e2->isConst())
if ((this->e1->isConst() && this->e2->isConst()) ||
(this->e1->op == TOKnull && this->e2->op == TOKnull))
{
e = Identity(op, type, this->e1, this->e2);
}