mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-04-18 09:49:02 +02:00
Change the numbering of static ctors/dtors to be module based instead of being global.
This fixes #210 by making sure that the static ctor always gets the same number, regardless of the order of the modules given at the command line.
This commit is contained in:
10
dmd/func.c
10
dmd/func.c
@@ -2420,7 +2420,7 @@ void DtorDeclaration::toCBuffer(OutBuffer *buf, HdrGenState *hgs)
|
||||
|
||||
StaticCtorDeclaration::StaticCtorDeclaration(Loc loc, Loc endloc)
|
||||
: FuncDeclaration(loc, endloc,
|
||||
Identifier::generateId("_staticCtor"), STCstatic, NULL)
|
||||
Lexer::idPool("_staticCtor"), STCstatic, NULL)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -2438,6 +2438,9 @@ void StaticCtorDeclaration::semantic(Scope *sc)
|
||||
{
|
||||
//printf("StaticCtorDeclaration::semantic()\n");
|
||||
|
||||
// get ourselves a scope-unique id
|
||||
ident = sc->module->generateId(ident);
|
||||
|
||||
type = new TypeFunction(NULL, Type::tvoid, FALSE, LINKd);
|
||||
|
||||
/* If the static ctor appears within a template instantiation,
|
||||
@@ -2521,7 +2524,7 @@ void StaticCtorDeclaration::toCBuffer(OutBuffer *buf, HdrGenState *hgs)
|
||||
|
||||
StaticDtorDeclaration::StaticDtorDeclaration(Loc loc, Loc endloc)
|
||||
: FuncDeclaration(loc, endloc,
|
||||
Identifier::generateId("_staticDtor"), STCstatic, NULL)
|
||||
Lexer::idPool("_staticDtor"), STCstatic, NULL)
|
||||
{
|
||||
vgate = NULL;
|
||||
}
|
||||
@@ -2538,6 +2541,9 @@ Dsymbol *StaticDtorDeclaration::syntaxCopy(Dsymbol *s)
|
||||
|
||||
void StaticDtorDeclaration::semantic(Scope *sc)
|
||||
{
|
||||
// get ourselves a scope-unique id
|
||||
ident = sc->module->generateId(ident);
|
||||
|
||||
ClassDeclaration *cd;
|
||||
Type *tret;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user