Mercurial > projects > ldc
diff dmd/func.c @ 1640:9bf06e02070b
Merge DMD 1.057.
author | Christian Kamm <kamm incasoftware de> |
---|---|
date | Mon, 08 Mar 2010 21:39:20 +0100 |
parents | 44b145be2ef5 |
children |
line wrap: on
line diff
--- a/dmd/func.c Mon Mar 08 20:09:18 2010 +0100 +++ b/dmd/func.c Mon Mar 08 21:39:20 2010 +0100 @@ -640,15 +640,15 @@ fdrequire = fd; } + if (!outId && f->nextOf()->toBasetype()->ty != Tvoid) + outId = Id::result; // provide a default + if (fensure) { /* out (result) { ... } * becomes: * tret __ensure(ref tret result) { ... } * __ensure(result); */ - if (!outId && f->nextOf()->toBasetype()->ty != Tvoid) - outId = Id::result; // provide a default - Loc loc = fensure->loc; Parameters *arguments = new Parameters(); Parameter *a = NULL; @@ -772,14 +772,14 @@ if (ad) { VarDeclaration *v; - if (isFuncLiteralDeclaration() && isNested()) + if (isFuncLiteralDeclaration() && isNested() && !sc->intypeof) { - error("literals cannot be class members"); + error("function literals cannot be class members"); return; } else { - assert(!isNested()); // can't be both member and nested + assert(!isNested() || sc->intypeof); // can't be both member and nested assert(ad->handle); v = new ThisDeclaration(loc, ad->handle); v->storage_class |= STCparameter | STCin; @@ -2628,15 +2628,9 @@ void FuncLiteralDeclaration::toCBuffer(OutBuffer *buf, HdrGenState *hgs) { - static Identifier *idfunc; - static Identifier *iddel; - - if (!idfunc) - idfunc = new Identifier("function", 0); - if (!iddel) - iddel = new Identifier("delegate", 0); - - type->toCBuffer(buf, ((tok == TOKdelegate) ? iddel : idfunc), hgs); + buf->writestring(kind()); + buf->writeByte(' '); + type->toCBuffer(buf, NULL, hgs); bodyToCBuffer(buf, hgs); }