[svn r39] * Updated to DMD 1.022 with the exception of:

Bugzilla 278: dmd.conf search path doesn't work

This fix was causing crashes for me :/ So for it's the old behaviour
This commit is contained in:
Tomas Lindquist Olsen
2007-10-09 06:21:30 +02:00
parent 3db5b9bb98
commit e251fc42b2
15 changed files with 277 additions and 114 deletions

View File

@@ -1,6 +1,6 @@
// Compiler implementation of the D programming language
// Copyright (c) 1999-2006 by Digital Mars
// Copyright (c) 1999-2007 by Digital Mars
// All Rights Reserved
// written by Walter Bright
// http://www.digitalmars.com
@@ -146,6 +146,20 @@ ClassDeclaration::ClassDeclaration(Loc loc, Identifier *id, BaseClasses *basecla
Type::typeinfotypelist->error("%s", msg);
Type::typeinfotypelist = this;
}
#if V2
if (id == Id::TypeInfo_Const)
{ if (Type::typeinfoconst)
Type::typeinfoconst->error("%s", msg);
Type::typeinfoconst = this;
}
if (id == Id::TypeInfo_Invariant)
{ if (Type::typeinfoinvariant)
Type::typeinfoinvariant->error("%s", msg);
Type::typeinfoinvariant = this;
}
#endif
}
if (id == Id::Object)
@@ -168,10 +182,6 @@ ClassDeclaration::ClassDeclaration(Loc loc, Identifier *id, BaseClasses *basecla
}
com = 0;
#if 0
if (id == Id::IUnknown) // IUnknown is the root of all COM objects
com = 1;
#endif
isauto = 0;
isabstract = 0;
isnested = 0;
@@ -249,6 +259,11 @@ void ClassDeclaration::semantic(Scope *sc)
methods.setDim(0);
#endif
if (sc->stc & STCdeprecated)
{ //printf("test1: %s is deprecated\n", toChars());
isdeprecated = 1;
}
// Expand any tuples in baseclasses[]
for (i = 0; i < baseclasses.dim; )
{ BaseClass *b = (BaseClass *)baseclasses.data[i];
@@ -286,6 +301,17 @@ void ClassDeclaration::semantic(Scope *sc)
else
{
tc = (TypeClass *)(tb);
if (tc->sym->isDeprecated())
{
if (!isDeprecated())
{
// Deriving from deprecated class makes this one deprecated too
isdeprecated = 1;
tc->checkDeprecated(loc, sc);
}
}
if (tc->sym->isInterfaceDeclaration())
;
else
@@ -340,6 +366,17 @@ void ClassDeclaration::semantic(Scope *sc)
}
else
{
if (tc->sym->isDeprecated())
{
if (!isDeprecated())
{
// Deriving from deprecated class makes this one deprecated too
isdeprecated = 1;
tc->checkDeprecated(loc, sc);
}
}
// Check for duplicate interfaces
for (size_t j = (baseClass ? 1 : 0); j < i; j++)
{
@@ -480,8 +517,6 @@ void ClassDeclaration::semantic(Scope *sc)
isauto = 1;
if (storage_class & STCabstract)
isabstract = 1;
if (storage_class & STCdeprecated)
isdeprecated = 1;
sc = sc->push(this);
sc->stc &= ~(STCfinal | STCauto | STCscope | STCstatic |
@@ -567,7 +602,7 @@ void ClassDeclaration::semantic(Scope *sc)
ctor->fbody = new CompoundStatement(0, new Statements());
members->push(ctor);
ctor->addMember(sc, this, 1);
*sc = scsave;
*sc = scsave; // why? What about sc->nofree?
sc->offset = structsize;
ctor->semantic(sc);
defaultCtor = ctor;
@@ -754,6 +789,35 @@ Dsymbol *ClassDeclaration::search(Loc loc, Identifier *ident, int flags)
return s;
}
/**********************************************************
* fd is in the vtbl[] for this class.
* Return 1 if function is hidden (not findable through search).
*/
#if V2
int isf(void *param, FuncDeclaration *fd)
{
//printf("param = %p, fd = %p %s\n", param, fd, fd->toChars());
return param == fd;
}
int ClassDeclaration::isFuncHidden(FuncDeclaration *fd)
{
//printf("ClassDeclaration::isFuncHidden(%s)\n", fd->toChars());
Dsymbol *s = search(0, fd->ident, 4|2);
if (!s)
{ //printf("not found\n");
/* Because, due to a hack, if there are multiple definitions
* of fd->ident, NULL is returned.
*/
return 0;
}
FuncDeclaration *fdstart = s->toAlias()->isFuncDeclaration();
//printf("%s fdstart = %p\n", s->kind(), fdstart);
return !overloadApply(fdstart, &isf, fd);
}
#endif
/****************
* Find virtual function matching identifier and type.
* Used to build virtual function tables for interface implementations.
@@ -802,7 +866,7 @@ void ClassDeclaration::interfaceSemantic(Scope *sc)
// If this is an interface, and it derives from a COM interface,
// then this is a COM interface too.
if (b->base->isCOMclass())
if (b->base->isCOMinterface())
com = 1;
vtblInterfaces->push(b);
@@ -818,6 +882,11 @@ int ClassDeclaration::isCOMclass()
return com;
}
int ClassDeclaration::isCOMinterface()
{
return 0;
}
/****************************************
*/
@@ -927,6 +996,11 @@ void InterfaceDeclaration::semantic(Scope *sc)
scope = NULL;
}
if (sc->stc & STCdeprecated)
{
isdeprecated = 1;
}
// Expand any tuples in baseclasses[]
for (i = 0; i < baseclasses.dim; )
{ BaseClass *b = (BaseClass *)baseclasses.data[0];
@@ -1044,7 +1118,7 @@ void InterfaceDeclaration::semantic(Scope *sc)
sc = sc->push(this);
sc->parent = this;
if (isCOMclass())
if (isCOMinterface())
sc->linkage = LINKwindows;
sc->structalign = 8;
structalign = sc->structalign;
@@ -1134,18 +1208,23 @@ int InterfaceDeclaration::isBaseOf(BaseClass *bc, int *poffset)
/****************************************
* Determine if slot 0 of the vtbl[] is reserved for something else.
* For class objects, yes, this is where the classinfo ptr goes.
* For class objects, yes, this is where the ClassInfo ptr goes.
* For COM interfaces, no.
* For non-COM interfaces, yes, this is where the Interface ptr goes.
*/
int InterfaceDeclaration::vtblOffset()
{
if (isCOMclass())
if (isCOMinterface())
return 0;
return 1;
}
int InterfaceDeclaration::isCOMinterface()
{
return com;
}
/*******************************************
*/