Run semantic3 on tuple declarations. This way, flag "availableExternally" will be set correctly for tuples.

This commit is contained in:
Alexey Prokhin
2011-01-03 20:07:58 +03:00
parent 9e3ef5e905
commit f8c0bce004
2 changed files with 24 additions and 0 deletions

View File

@@ -244,6 +244,26 @@ int TupleDeclaration::needThis()
return 0;
}
#if IN_LLVM
void TupleDeclaration::semantic3(Scope *sc)
{
//printf("TupleDeclaration::semantic3((%s)\n", toChars());
for (size_t i = 0; i < objects->dim; i++)
{ Object *o = (Object *)objects->data[i];
if (o->dyncast() == DYNCAST_EXPRESSION)
{ Expression *e = (Expression *)o;
if (e->op == TOKdsymbol)
{ DsymbolExp *ve = (DsymbolExp *)e;
Declaration *d = ve->s->isDeclaration();
d->semantic3(sc);
}
}
}
}
#endif
/********************************* TypedefDeclaration ****************************/
TypedefDeclaration::TypedefDeclaration(Loc loc, Identifier *id, Type *basetype, Initializer *init)
@@ -1381,6 +1401,9 @@ void VarDeclaration::semantic3(Scope *sc)
if (!global.params.useAvailableExternally)
availableExternally = false;
if (aliassym)
aliassym->semantic3(sc);
// Preserve call chain
Declaration::semantic3(sc);
}

View File

@@ -193,6 +193,7 @@ struct TupleDeclaration : Declaration
TupleDeclaration *isTupleDeclaration() { return this; }
#if IN_LLVM
void semantic3(Scope *sc);
/// Codegen traversal
void codegen(Ir* ir);
#endif