From f8c0bce00497fd4052d1643575699541326b92c1 Mon Sep 17 00:00:00 2001 From: Alexey Prokhin Date: Mon, 3 Jan 2011 20:07:58 +0300 Subject: [PATCH] Run semantic3 on tuple declarations. This way, flag "availableExternally" will be set correctly for tuples. --- dmd2/declaration.c | 23 +++++++++++++++++++++++ dmd2/declaration.h | 1 + 2 files changed, 24 insertions(+) diff --git a/dmd2/declaration.c b/dmd2/declaration.c index fdee2e5a..282e768e 100644 --- a/dmd2/declaration.c +++ b/dmd2/declaration.c @@ -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); } diff --git a/dmd2/declaration.h b/dmd2/declaration.h index 2f8551b4..e56d441d 100644 --- a/dmd2/declaration.h +++ b/dmd2/declaration.h @@ -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