[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

@@ -554,6 +554,8 @@ Expression *Type::getProperty(Loc loc, Identifier *ident)
}
else if (ident == Id::init)
{
if (ty == Tvoid)
error(loc, "void does not have an initializer");
e = defaultInit();
e->loc = loc;
}
@@ -642,7 +644,9 @@ Expression *Type::dotExp(Scope *sc, Expression *e, Identifier *ident)
return e;
}
#endif
return defaultInit();
Expression *ex = defaultInit();
ex->loc = e->loc;
return ex;
}
}
if (ident == Id::typeinfo)
@@ -3760,6 +3764,8 @@ Expression *TypeEnum::dotExp(Scope *sc, Expression *e, Identifier *ident)
#if LOGDOTEXP
printf("TypeEnum::dotExp(e = '%s', ident = '%s') '%s'\n", e->toChars(), ident->toChars(), toChars());
#endif
if (!sym->symtab)
goto Lfwd;
s = sym->symtab->lookup(ident);
if (!s)
{
@@ -3769,6 +3775,10 @@ Expression *TypeEnum::dotExp(Scope *sc, Expression *e, Identifier *ident)
em = m->value->copy();
em->loc = e->loc;
return em;
Lfwd:
error(e->loc, "forward reference of %s.%s", toChars(), ident->toChars());
return new IntegerExp(0, 0, this);
}
Expression *TypeEnum::getProperty(Loc loc, Identifier *ident)
@@ -4472,6 +4482,9 @@ L1:
t = ClassDeclaration::classinfo->type;
if (e->op == TOKtype || e->op == TOKdottype)
{
/* For type.classinfo, we know the classinfo
* at compile time.
*/
if (!sym->vclassinfo)
sym->vclassinfo = new ClassInfoDeclaration(sym);
e = new VarExp(e->loc, sym->vclassinfo);
@@ -4479,13 +4492,25 @@ L1:
e->type = t; // do this so we don't get redundant dereference
}
else
{
{ /* For class objects, the classinfo reference is the first
* entry in the vtbl[]
*/
e = new PtrExp(e->loc, e);
e->type = t->pointerTo();
if (sym->isInterfaceDeclaration())
{
if (sym->isCOMclass())
if (sym->isCOMinterface())
{ /* COM interface vtbl[]s are different in that the
* first entry is always pointer to QueryInterface().
* We can't get a .classinfo for it.
*/
error(e->loc, "no .classinfo for COM interface objects");
}
/* For an interface, the first entry in the vtbl[]
* is actually a pointer to an instance of struct Interface.
* The first member of Interface is the .classinfo,
* so add an extra pointer indirection.
*/
e->type = e->type->pointerTo();
e = new PtrExp(e->loc, e);
e->type = t->pointerTo();