Mercurial > projects > ldc
diff dmd2/declaration.c @ 1526:54b3c1394d62
Merged dmdfe 2.031.
author | Robert Clipsham <robert@octarineparrot.com> |
---|---|
date | Tue, 07 Jul 2009 02:26:11 +0100 |
parents | f62347c22d81 |
children | e4f7b5d9c68a |
line wrap: on
line diff
--- a/dmd2/declaration.c Mon Jul 06 23:57:27 2009 +0100 +++ b/dmd2/declaration.c Tue Jul 07 02:26:11 2009 +0100 @@ -463,6 +463,7 @@ if (s && ((s->getType() && type->equals(s->getType())) || s->isEnumMember())) goto L2; // it's a symbolic alias +#if DMDV2 if (storage_class & STCref) { // For 'ref' to be attached to function types, and picked // up by Type::resolve(), it has to go into sc. @@ -472,6 +473,7 @@ sc = sc->pop(); } else +#endif type->resolve(loc, sc, &e, &t, &s); if (s) { @@ -488,7 +490,9 @@ t = e->type; } else if (t) + { type = t; + } if (overnext) ScopeDsymbol::multiplyDefined(0, this, overnext); this->inSemantic = 0; @@ -511,7 +515,9 @@ if (overnext) { FuncAliasDeclaration *fa = new FuncAliasDeclaration(f); +#if IN_LLVM fa->importprot = importprot; +#endif if (!fa->overloadInsert(overnext)) ScopeDsymbol::multiplyDefined(0, f, overnext); overnext = NULL; @@ -527,6 +533,7 @@ s = NULL; } } + //printf("setting aliassym %p to %p\n", this, s); aliassym = s; this->inSemantic = 0; } @@ -624,12 +631,14 @@ this->loc = loc; offset = 0; noauto = 0; +#if DMDV1 + nestedref = 0; +#endif ctorinit = 0; aliassym = NULL; onstack = 0; canassign = 0; value = NULL; - scope = NULL; #if IN_LLVM aggrIndex = 0; @@ -730,10 +739,12 @@ //printf("sc->stc = %x\n", sc->stc); //printf("storage_class = x%x\n", storage_class); +#if DMDV2 if (storage_class & STCgshared && global.params.safe && !sc->module->safe) { error("__gshared not allowed in safe mode; use shared"); } +#endif Dsymbol *parent = toParent(); FuncDeclaration *fd = parent->isFuncDeclaration(); @@ -851,7 +862,9 @@ if (!aad) aad = parent->isAggregateDeclaration(); if (aad) - { assert(!(storage_class & (STCextern | STCstatic | STCtls | STCgshared))); + { +#if DMDV2 + assert(!(storage_class & (STCextern | STCstatic | STCtls | STCgshared))); if (storage_class & (STCconst | STCimmutable) && init) { @@ -859,6 +872,7 @@ storage_class |= STCstatic; } else +#endif aad->addField(sc, this); } @@ -891,11 +905,13 @@ } } +#if DMDV2 if ((storage_class & (STCref | STCparameter | STCforeach)) == STCref && ident != Id::This) { error("only parameters or foreach declarations can be ref"); } +#endif if (type->isauto() && !noauto) { @@ -940,7 +956,9 @@ Expression *e1; e1 = new VarExp(loc, this); e = new AssignExp(loc, e1, e); +#if DMDV2 e->op = TOKconstruct; +#endif e->type = e1->type; // don't type check this, it would fail init = new ExpInitializer(loc, e); return; @@ -961,8 +979,10 @@ { init = getExpInitializer(); } +#if DMDV2 // Default initializer is always a blit op = TOKblit; +#endif } if (init) @@ -1040,7 +1060,7 @@ else if (t->ty == Tstruct) { ei->exp = ei->exp->semantic(sc); - +#if DMDV2 /* Look to see if initializer is a call to the constructor */ StructDeclaration *sd = ((TypeStruct *)t)->sym; @@ -1078,7 +1098,7 @@ } } } - +#endif if (!ei->exp->implicitConvTo(type)) { Type *ti = ei->exp->type->toBasetype(); // Don't cast away invariant or mutability in initializer @@ -1132,11 +1152,12 @@ { if (global.gag == 0) global.errors = errors; // act as if nothing happened - +#if DMDV2 /* Save scope for later use, to try again */ scope = new Scope(*sc); scope->setNoFree(); +#endif } else if (ei) { @@ -1150,6 +1171,7 @@ { ei->exp = e; // no errors, keep result } +#if DMDV2 else { /* Save scope for later use, to try again @@ -1157,6 +1179,7 @@ scope = new Scope(*sc); scope->setNoFree(); } +#endif } else init = i2; // no errors, keep result @@ -1220,10 +1243,12 @@ buf->writestring(ident->toChars()); if (init) { buf->writestring(" = "); +#if DMDV2 ExpInitializer *ie = init->isExpInitializer(); if (ie && (ie->exp->op == TOKconstruct || ie->exp->op == TOKblit)) ((AssignExp *)ie->exp)->e2->toCBuffer(buf, hgs); else +#endif init->toCBuffer(buf, hgs); } buf->writeByte(';'); @@ -1588,9 +1613,10 @@ void TypeInfoDeclaration::semantic(Scope *sc) { assert(linkage == LINKc); - // LDC +#if IN_LLVM if (!global.params.useAvailableExternally) availableExternally = false; +#endif } /***************************** TypeInfoConstDeclaration **********************/