Mercurial > projects > ldc
diff dmd/expression.c @ 35:3cfcb944304e trunk
[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
author | lindquist |
---|---|
date | Tue, 09 Oct 2007 06:21:30 +0200 |
parents | 788401029ecf |
children | 0b9b286b67b6 |
line wrap: on
line diff
--- a/dmd/expression.c Tue Oct 09 02:50:00 2007 +0200 +++ b/dmd/expression.c Tue Oct 09 06:21:30 2007 +0200 @@ -2354,26 +2354,36 @@ return result ? TRUE : FALSE; } +unsigned StringExp::charAt(size_t i) +{ unsigned value; + + switch (sz) + { + case 1: + value = ((unsigned char *)string)[i]; + break; + + case 2: + value = ((unsigned short *)string)[i]; + break; + + case 4: + value = ((unsigned int *)string)[i]; + break; + + default: + assert(0); + break; + } + return value; +} + void StringExp::toCBuffer(OutBuffer *buf, HdrGenState *hgs) { buf->writeByte('"'); for (size_t i = 0; i < len; i++) - { unsigned c; - - switch (sz) - { - case 1: - c = ((unsigned char *)string)[i]; - break; - case 2: - c = ((unsigned short *)string)[i]; - break; - case 4: - c = ((unsigned *)string)[i]; - break; - default: - assert(0); - } + { unsigned c = charAt(i); + switch (c) { case '"': @@ -4933,7 +4943,7 @@ { AggregateDeclaration *ad = var->toParent()->isAggregateDeclaration(); L1: - Type *t = e1->type; + Type *t = e1->type->toBasetype(); if (ad && !(t->ty == Tpointer && t->next->ty == Tstruct && @@ -5467,6 +5477,7 @@ */ Expression *e = new StructLiteralExp(loc, (StructDeclaration *)ad, arguments); e = e->semantic(sc); + e->type = e1->type; // in case e1->type was a typedef return e; } else if (t1->ty == Tclass) @@ -6087,8 +6098,11 @@ { TypeClass *tc = (TypeClass *)tb; ClassDeclaration *cd = tc->sym; - if (cd->isInterfaceDeclaration() && cd->isCOMclass()) + if (cd->isCOMinterface()) + { /* Because COM classes are deleted by IUnknown.Release() + */ error("cannot delete instance of COM interface %s", cd->toChars()); + } break; } case Tpointer: