diff -uNr dmd-1.007/dmd/src/dmd/constfold.c dmd-1.009/dmd/src/dmd/constfold.c --- dmd-1.007/dmd/src/dmd/constfold.c 2007-02-20 16:05:12.000000000 +0100 +++ dmd-1.009/dmd/src/dmd/constfold.c 2007-03-09 12:53:10.000000000 +0100 @@ -457,7 +457,7 @@ n1 = e1->toInteger(); n2 = e2->toInteger(); if (n2 == 0) - { error("divide by 0"); + { e2->error("divide by 0"); e2 = new IntegerExp(0, 1, e2->type); n2 = 1; } @@ -520,7 +520,7 @@ n1 = e1->toInteger(); n2 = e2->toInteger(); if (n2 == 0) - { error("divide by 0"); + { e2->error("divide by 0"); e2 = new IntegerExp(0, 1, e2->type); n2 = 1; } @@ -1029,7 +1029,8 @@ { Expression *e = EXP_CANT_INTERPRET; Loc loc = e1->loc; - //printf("Index(e1->type = %p)\n", e1->type); + //printf("Index(e1 = %s)\n", e1->toChars()); + assert(e1->type); if (e1->op == TOKstring && e2->op == TOKint64) { StringExp *es1 = (StringExp *)e1; uinteger_t i = e2->toInteger(); @@ -1066,7 +1067,7 @@ uinteger_t i = e2->toInteger(); if (i >= length) - { error("array index %ju is out of bounds [0 .. %ju]", i, length); + { e2->error("array index %ju is out of bounds %s[0 .. %ju]", i, e1->toChars(), length); } else if (e1->op == TOKarrayliteral && !e1->checkSideEffect(2)) { ArrayLiteralExp *ale = (ArrayLiteralExp *)e1; @@ -1144,6 +1145,7 @@ Expression *Cat(Type *type, Expression *e1, Expression *e2) { Expression *e = EXP_CANT_INTERPRET; Loc loc = e1->loc; + Type *t; //printf("Cat(e1 = %s, e2 = %s)\n", e1->toChars(), e2->toChars()); @@ -1184,8 +1186,7 @@ e->type = type; return e; } - - if (e1->op == TOKstring && e2->op == TOKstring) + else if (e1->op == TOKstring && e2->op == TOKstring) { // Concatenate the strings void *s; @@ -1319,12 +1320,21 @@ } else if (e1->op == TOKnull && e2->op == TOKstring) { + t = e1->type; e = e2; goto L1; } else if (e1->op == TOKstring && e2->op == TOKnull) { e = e1; + t = e2->type; L1: + Type *tb = t->toBasetype(); + if (tb->ty == Tarray && tb->next->equals(e->type)) + { Expressions *expressions = new Expressions(); + expressions->push(e); + e = new ArrayLiteralExp(loc, expressions); + e->type = t; + } if (!e->type->equals(type)) { StringExp *se = (StringExp *)e->copy(); e = se->castTo(NULL, type); diff -uNr dmd-1.007/dmd/src/dmd/declaration.c dmd-1.009/dmd/src/dmd/declaration.c --- dmd-1.007/dmd/src/dmd/declaration.c 2007-02-16 01:22:06.000000000 +0100 +++ dmd-1.009/dmd/src/dmd/declaration.c 2007-03-07 12:09:56.000000000 +0100 @@ -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 // www.digitalmars.com @@ -149,6 +149,26 @@ return tupletype; } +int TupleDeclaration::needThis() +{ + //printf("TupleDeclaration::needThis(%s)\n", toChars()); + for (size_t i = 0; i < objects->dim; i++) + { Object *o = (Object *)objects->data[i]; + if (o->dyncast() == DYNCAST_EXPRESSION) + { Expression *e = (Expression *)o; + if (e->op == TOKdsymbol) + { DsymbolExp *ve = (DsymbolExp *)e; + Declaration *d = ve->s->isDeclaration(); + if (d && d->needThis()) + { + return 1; + } + } + } + } + return 0; +} + /********************************* TypedefDeclaration ****************************/ TypedefDeclaration::TypedefDeclaration(Loc loc, Identifier *id, Type *basetype, Initializer *init) @@ -965,6 +985,7 @@ int VarDeclaration::needThis() { + //printf("VarDeclaration::needThis(%s, x%x)\n", toChars(), storage_class); return storage_class & STCfield; } diff -uNr dmd-1.007/dmd/src/dmd/declaration.h dmd-1.009/dmd/src/dmd/declaration.h --- dmd-1.007/dmd/src/dmd/declaration.h 2007-02-20 13:32:10.000000000 +0100 +++ dmd-1.009/dmd/src/dmd/declaration.h 2007-03-06 23:37:02.000000000 +0100 @@ -130,6 +130,7 @@ Dsymbol *syntaxCopy(Dsymbol *); char *kind(); Type *getType(); + int needThis(); TupleDeclaration *isTupleDeclaration() { return this; } }; @@ -504,6 +505,7 @@ FuncAliasDeclaration *isFuncAliasDeclaration() { return this; } char *kind(); + Symbol *toSymbol(); }; struct FuncLiteralDeclaration : FuncDeclaration diff -uNr dmd-1.007/dmd/src/dmd/expression.c dmd-1.009/dmd/src/dmd/expression.c --- dmd-1.007/dmd/src/dmd/expression.c 2007-02-20 13:28:38.000000000 +0100 +++ dmd-1.009/dmd/src/dmd/expression.c 2007-03-07 00:03:46.000000000 +0100 @@ -1145,7 +1145,9 @@ break; } case Tchar: - if (isprint(v) && v != '\\') + if (v == '\'') + buf->writestring("'\\''"); + else if (isprint(v) && v != '\\') buf->printf("'%c'", (int)v); else buf->printf("'\\x%02x'", (int)v); @@ -1820,23 +1822,8 @@ TupleDeclaration *tup = s->isTupleDeclaration(); if (tup) - { Expressions *exps = new Expressions(); - - exps->reserve(tup->objects->dim); - for (size_t i = 0; i < tup->objects->dim; i++) - { Object *o = (Object *)tup->objects->data[i]; - if (o->dyncast() != DYNCAST_EXPRESSION) - { - error("%s is not an expression", o->toChars()); - } - else - { - Expression *e = (Expression *)o; - e = e->syntaxCopy(); - exps->push(e); - } - } - e = new TupleExp(loc, exps); + { + e = new TupleExp(loc, tup); e = e->semantic(sc); return e; } @@ -2747,6 +2734,7 @@ } else type = newtype->semantic(loc, sc); + newtype = type; // in case type gets cast to something else tb = type->toBasetype(); //printf("tb: %s, deco = %s\n", tb->toChars(), tb->deco); @@ -3268,6 +3256,35 @@ this->type = NULL; } + +TupleExp::TupleExp(Loc loc, TupleDeclaration *tup) + : Expression(loc, TOKtuple, sizeof(TupleExp)) +{ + exps = new Expressions(); + type = NULL; + + exps->reserve(tup->objects->dim); + for (size_t i = 0; i < tup->objects->dim; i++) + { Object *o = (Object *)tup->objects->data[i]; + if (o->dyncast() == DYNCAST_EXPRESSION) + { + Expression *e = (Expression *)o; + e = e->syntaxCopy(); + exps->push(e); + } + else if (o->dyncast() == DYNCAST_DSYMBOL) + { + Dsymbol *s = (Dsymbol *)o; + Expression *e = new DsymbolExp(loc, s); + exps->push(e); + } + else + { + error("%s is not an expression", o->toChars()); + } + } +} + int TupleExp::equals(Object *o) { TupleExp *ne; @@ -4711,7 +4728,7 @@ id = (Identifier *)ti->idents.data[0]; s2 = s->search(loc, id, 0); if (!s2) - { error("template identifier %s is not a member of %s", id->toChars(), s->ident->toChars()); + { error("template identifier %s is not a member of %s %s", id->toChars(), s->kind(), s->ident->toChars()); goto Lerr; } s = s2; diff -uNr dmd-1.007/dmd/src/dmd/expression.h dmd-1.009/dmd/src/dmd/expression.h --- dmd-1.007/dmd/src/dmd/expression.h 2007-02-20 13:46:54.000000000 +0100 +++ dmd-1.009/dmd/src/dmd/expression.h 2007-03-07 14:48:52.000000000 +0100 @@ -18,6 +18,7 @@ struct Type; struct Scope; +struct TupleDeclaration; struct VarDeclaration; struct FuncDeclaration; struct FuncLiteralDeclaration; @@ -324,6 +325,7 @@ Expressions *exps; TupleExp(Loc loc, Expressions *exps); + TupleExp(Loc loc, TupleDeclaration *tup); Expression *syntaxCopy(); int equals(Object *o); Expression *semantic(Scope *sc); @@ -1305,6 +1307,7 @@ #define EXP_CONTINUE_INTERPRET ((Expression *)2) #define EXP_BREAK_INTERPRET ((Expression *)3) #define EXP_GOTO_INTERPRET ((Expression *)4) +#define EXP_VOID_INTERPRET ((Expression *)5) Expression *expType(Type *type, Expression *e); diff -uNr dmd-1.007/dmd/src/dmd/init.c dmd-1.009/dmd/src/dmd/init.c --- dmd-1.007/dmd/src/dmd/init.c 2007-02-13 23:27:24.000000000 +0100 +++ dmd-1.009/dmd/src/dmd/init.c 2007-03-10 23:54:22.000000000 +0100 @@ -359,6 +359,8 @@ Expression *ArrayInitializer::toExpression() { Expressions *elements; + //printf("ArrayInitializer::toExpression()\n"); + //static int i; if (++i == 2) halt(); elements = new Expressions(); for (size_t i = 0; i < value.dim; i++) { diff -uNr dmd-1.007/dmd/src/dmd/interpret.c dmd-1.009/dmd/src/dmd/interpret.c --- dmd-1.007/dmd/src/dmd/interpret.c 2007-02-20 16:07:00.000000000 +0100 +++ dmd-1.009/dmd/src/dmd/interpret.c 2007-03-10 23:52:42.000000000 +0100 @@ -75,7 +75,7 @@ assert(tb->ty == Tfunction); TypeFunction *tf = (TypeFunction *)tb; Type *tret = tf->next->toBasetype(); - if (tf->varargs || tret->ty == Tvoid) + if (tf->varargs /*|| tret->ty == Tvoid*/) { cantInterpret = 1; return NULL; } @@ -91,21 +91,6 @@ } } - /* Save the values of the local variables used - */ - Expressions valueSaves; - if (istate) - { - valueSaves.setDim(istate->vars.dim); - for (size_t i = 0; i < istate->vars.dim; i++) - { VarDeclaration *v = (VarDeclaration *)istate->vars.data[i]; - if (v) - { valueSaves.data[i] = v->value; - v->value = NULL; - } - } - } - InterState istatex; istatex.caller = istate; istatex.fd = this; @@ -173,6 +158,24 @@ } } + /* Save the values of the local variables used + */ + Expressions valueSaves; + if (istate) + { + //printf("saving state...\n"); + valueSaves.setDim(istate->vars.dim); + for (size_t i = 0; i < istate->vars.dim; i++) + { VarDeclaration *v = (VarDeclaration *)istate->vars.data[i]; + if (v) + { + //printf("\tsaving [%d] %s = %s\n", i, v->toChars(), v->value->toChars()); + valueSaves.data[i] = v->value; + v->value = NULL; + } + } + } + Expression *e = NULL; while (1) @@ -252,7 +255,7 @@ Expression *ExpStatement::interpret(InterState *istate) { #if LOG - printf("ExpStatement::interpret()\n"); + printf("ExpStatement::interpret(%s)\n", exp ? exp->toChars() : ""); #endif START() if (exp) @@ -285,6 +288,9 @@ break; } } +#if LOG + printf("-CompoundStatement::interpret() %p\n", e); +#endif return e; } @@ -374,10 +380,11 @@ Expression *ReturnStatement::interpret(InterState *istate) { #if LOG - printf("ReturnStatement::interpret()\n"); + printf("ReturnStatement::interpret(%s)\n", exp ? exp->toChars() : ""); #endif START() - assert(exp); + if (!exp) + return EXP_VOID_INTERPRET; return exp->interpret(istate); } @@ -836,7 +843,10 @@ if (v) { if (v->isConst() && v->init) - e = v->init->toExpression(); + { e = v->init->toExpression(); + if (!e->type) + e->type = v->type; + } else { e = v->value; if (!e) @@ -851,7 +861,11 @@ } Expression *DeclarationExp::interpret(InterState *istate) -{ Expression *e = EXP_CANT_INTERPRET; +{ +#if LOG + printf("DeclarationExp::interpret() %s\n", toChars()); +#endif + Expression *e = EXP_CANT_INTERPRET; VarDeclaration *v = declaration->isVarDeclaration(); if (v) { @@ -864,12 +878,23 @@ else if (v->init->isVoidInitializer()) e = NULL; } + else if (s == v && v->isConst() && v->init) + { e = v->init->toExpression(); + if (!e) + e = EXP_CANT_INTERPRET; + else if (!e->type) + e->type = v->type; + } } return e; } Expression *TupleExp::interpret(InterState *istate) -{ Expressions *expsx = NULL; +{ +#if LOG + printf("VarExp::interpret() %s\n", toChars()); +#endif + Expressions *expsx = NULL; for (size_t i = 0; i < exps->dim; i++) { Expression *e = (Expression *)exps->data[i]; @@ -1031,16 +1056,19 @@ Expression *e1; Expression *e2; +#if LOG + printf("BinExp::interpretCommon2() %s\n", toChars()); +#endif e1 = this->e1->interpret(istate); if (e1 == EXP_CANT_INTERPRET) goto Lcant; - if (e1->isConst() != 1) + if (e1->isConst() != 1 && e1->op != TOKstring && e1->op != TOKarrayliteral) goto Lcant; e2 = this->e2->interpret(istate); if (e2 == EXP_CANT_INTERPRET) goto Lcant; - if (e2->isConst() != 1) + if (e2->isConst() != 1 && e2->op != TOKstring && e2->op != TOKarrayliteral) goto Lcant; e = (*fp)(op, type, e1, e2); @@ -1103,7 +1131,7 @@ e2 = Cast(v->type, v->type, e2); if (e2 != EXP_CANT_INTERPRET) { - if (v->isAuto()) + if (!(v->isDataseg() || v->isParameter())) { for (size_t i = 0; 1; i++) { @@ -1276,6 +1304,8 @@ Expression *eresult = fd->interpret(istate, arguments); if (eresult) e = eresult; + else if (fd->type->toBasetype()->next->ty == Tvoid) + e = EXP_VOID_INTERPRET; else error("cannot evaluate %s at compile time", toChars()); } @@ -1334,6 +1364,9 @@ Expression *e1; Expression *e2; +#if LOG + printf("IndexExp::interpret() %s\n", toChars()); +#endif e1 = this->e1->interpret(istate); if (e1 == EXP_CANT_INTERPRET) goto Lcant; diff -uNr dmd-1.007/dmd/src/dmd/mangle.c dmd-1.009/dmd/src/dmd/mangle.c --- dmd-1.007/dmd/src/dmd/mangle.c 2006-12-14 19:16:56.000000000 +0100 +++ dmd-1.009/dmd/src/dmd/mangle.c 2007-03-09 20:57:42.000000000 +0100 @@ -30,10 +30,11 @@ char *id; Dsymbol *s; + //printf("::mangle(%s)\n", sthis->toChars()); s = sthis; do { - //printf("s = %p, '%s', parent = %p\n", s, s->toChars(), s->parent); + //printf("mangle: s = %p, '%s', parent = %p\n", s, s->toChars(), s->parent); if (s->ident) { FuncDeclaration *fd = s->isFuncDeclaration(); @@ -60,11 +61,16 @@ // buf.prependstring("_D"); L1: - //printf("deco = '%s'\n", sthis->type->deco); + //printf("deco = '%s'\n", sthis->type->deco ? sthis->type->deco : "null"); + //printf("sthis->type = %s\n", sthis->type->toChars()); FuncDeclaration *fd = sthis->isFuncDeclaration(); if (fd && (fd->needThis() || fd->isNested())) buf.writeByte(Type::needThisPrefix()); - buf.writestring(sthis->type->deco); + if (sthis->type->deco) + buf.writestring(sthis->type->deco); + else + { assert(fd->inferRetType); + } id = buf.toChars(); buf.data = NULL; @@ -134,6 +140,7 @@ if (isMain()) return "_Dmain"; + assert(this); return Declaration::mangle(); } diff -uNr dmd-1.007/dmd/src/dmd/mars.c dmd-1.009/dmd/src/dmd/mars.c --- dmd-1.007/dmd/src/dmd/mars.c 2007-02-16 01:17:36.000000000 +0100 +++ dmd-1.009/dmd/src/dmd/mars.c 2007-03-05 10:54:28.000000000 +0100 @@ -60,7 +60,7 @@ copyright = "Copyright (c) 1999-2007 by Digital Mars"; written = "written by Walter Bright"; - version = "v1.007"; + version = "v1.009"; global.structalign = 8; memset(¶ms, 0, sizeof(Param)); diff -uNr dmd-1.007/dmd/src/dmd/mars.h dmd-1.009/dmd/src/dmd/mars.h --- dmd-1.007/dmd/src/dmd/mars.h 2007-02-08 16:11:02.000000000 +0100 +++ dmd-1.009/dmd/src/dmd/mars.h 2007-03-09 21:14:04.000000000 +0100 @@ -18,6 +18,13 @@ #include #include +#ifdef __DMC__ +#ifdef DEBUG +#undef assert +#define assert(e) (static_cast((e) || (printf("assert %s(%d) %s\n", __FILE__, __LINE__, #e), halt()))) +#endif +#endif + #ifdef IN_GCC /* Changes for the GDC compiler by David Friedman */ #endif diff -uNr dmd-1.007/dmd/src/dmd/mtype.c dmd-1.009/dmd/src/dmd/mtype.c --- dmd-1.007/dmd/src/dmd/mtype.c 2007-02-20 13:39:54.000000000 +0100 +++ dmd-1.009/dmd/src/dmd/mtype.c 2007-03-07 00:04:24.000000000 +0100 @@ -3082,7 +3082,12 @@ id = (Identifier *)ti->idents.data[0]; sm = s->search(loc, id, 0); if (!sm) - { error(loc, "template identifier %s is not a member of %s", id->toChars(), s->toChars()); + { +#ifdef DEBUG + printf("1: \n"); +#endif + error(loc, "template identifier %s is not a member of %s %s", + id->toChars(), s->kind(), s->toChars()); return; } sm = sm->toAlias(); @@ -3318,11 +3323,11 @@ s = sc->search(loc, ident, &scopesym); if (s) { - s = s->toAlias(); for (int i = 0; i < idents.dim; i++) { Identifier *id; Dsymbol *sm; + s = s->toAlias(); id = (Identifier *)idents.data[i]; //printf("\tid = '%s'\n", id->toChars()); if (id->dyncast() != DYNCAST_IDENTIFIER) @@ -3334,20 +3339,35 @@ id = (Identifier *)ti->idents.data[0]; sm = s->search(loc, id, 0); if (!sm) - { error(loc, "template identifier %s is not a member of %s", id->toChars(), s->toChars()); - break; + { + Type *t = s->getType(); + if (t) + sm = t->toDsymbol(sc); + if (!sm) + { +#ifdef DEBUG + printf("E2: %s\n", s->getType()->toChars()); +#endif + error(loc, "template identifier %s is not a member of %s %s", + id->toChars(), s->kind(), s->toChars()); + break; + } + sm = sm->toAlias(); } - sm = sm->toAlias(); - td = sm->isTemplateDeclaration(); - if (!td) + else { - error(loc, "%s is not a template", id->toChars()); - break; + sm = sm->toAlias(); + td = sm->isTemplateDeclaration(); + if (!td) + { + error(loc, "%s %s is not a template", sm->kind(), id->toChars()); + break; + } + ti->tempdecl = td; + if (!ti->semanticdone) + ti->semantic(sc); + sm = ti->toAlias(); } - ti->tempdecl = td; - if (!ti->semanticdone) - ti->semantic(sc); - sm = ti->toAlias(); } else sm = s->search(loc, id, 0); @@ -3357,7 +3377,6 @@ { //printf("\tdidn't find a symbol\n"); break; } - s = s->toAlias(); } } return s; @@ -4226,6 +4245,12 @@ e = e->semantic(sc); return e; } + if (d->isTupleDeclaration()) + { + e = new TupleExp(e->loc, d->isTupleDeclaration()); + e = e->semantic(sc); + return e; + } return new VarExp(e->loc, d); } @@ -4554,6 +4579,12 @@ e = de->semantic(sc); return e; } + else if (d->isTupleDeclaration()) + { + e = new TupleExp(e->loc, d->isTupleDeclaration()); + e = e->semantic(sc); + return e; + } else ve = new VarExp(e->loc, d); return ve; diff -uNr dmd-1.007/dmd/src/dmd/optimize.c dmd-1.009/dmd/src/dmd/optimize.c --- dmd-1.007/dmd/src/dmd/optimize.c 2007-02-18 01:01:42.000000000 +0100 +++ dmd-1.009/dmd/src/dmd/optimize.c 2007-03-09 12:53:02.000000000 +0100 @@ -42,6 +42,7 @@ Expression *fromConstInitializer(Expression *e1) { + //printf("fromConstInitializer(%s)\n", e1->toChars()); if (e1->op == TOKvar) { VarExp *ve = (VarExp *)e1; VarDeclaration *v = ve->var->isVarDeclaration(); diff -uNr dmd-1.007/dmd/src/dmd/statement.c dmd-1.009/dmd/src/dmd/statement.c --- dmd-1.007/dmd/src/dmd/statement.c 2007-02-16 01:47:36.000000000 +0100 +++ dmd-1.009/dmd/src/dmd/statement.c 2007-02-22 22:10:44.000000000 +0100 @@ -1136,11 +1136,11 @@ //printf("aggr: op = %d, %s\n", aggr->op, aggr->toChars()); size_t n; TupleExp *te = NULL; - if (aggr->op == TOKtuple) + if (aggr->op == TOKtuple) // expression tuple { te = (TupleExp *)aggr; n = te->exps->dim; } - else if (aggr->op == TOKtype) + else if (aggr->op == TOKtype) // type tuple { n = Argument::dim(tuple->arguments); } @@ -1182,9 +1182,17 @@ Dsymbol *var; if (te) { - arg->type = e->type; - Initializer *ie = new ExpInitializer(0, e); - var = new VarDeclaration(loc, arg->type, arg->ident, ie); + if (e->type->toBasetype()->ty == Tfunction && + e->op == TOKvar) + { VarExp *ve = (VarExp *)e; + var = new AliasDeclaration(loc, arg->ident, ve->var); + } + else + { + arg->type = e->type; + Initializer *ie = new ExpInitializer(0, e); + var = new VarDeclaration(loc, arg->type, arg->ident, ie); + } } else { diff -uNr dmd-1.007/dmd/src/dmd/staticassert.c dmd-1.009/dmd/src/dmd/staticassert.c --- dmd-1.007/dmd/src/dmd/staticassert.c 2006-06-01 18:03:40.000000000 +0200 +++ dmd-1.009/dmd/src/dmd/staticassert.c 2007-03-07 10:37:38.000000000 +0100 @@ -1,5 +1,5 @@ -// Copyright (c) 1999-2006 by Digital Mars +// Copyright (c) 1999-2007 by Digital Mars // All Rights Reserved // written by Walter Bright // www.digitalmars.com @@ -49,20 +49,20 @@ Expression *e; e = exp->semantic(sc); - e = e->optimize(WANTvalue); + e = e->optimize(WANTvalue | WANTinterpret); if (e->isBool(FALSE)) { if (msg) { msg = msg->semantic(sc); - msg = msg->optimize(WANTvalue); + msg = msg->optimize(WANTvalue | WANTinterpret); char *p = msg->toChars(); p = strdup(p); - error("(%s) is false, %s", exp->toChars(), p); + error("%s", p); free(p); } else - error("(%s) is false", exp->toChars()); + error("is false"); if (!global.gag) fatal(); } diff -uNr dmd-1.007/dmd/src/dmd/tocsym.c dmd-1.009/dmd/src/dmd/tocsym.c --- dmd-1.007/dmd/src/dmd/tocsym.c 2007-01-15 00:57:18.000000000 +0100 +++ dmd-1.009/dmd/src/dmd/tocsym.c 2007-03-07 17:10:52.000000000 +0100 @@ -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 // www.digitalmars.com @@ -174,7 +174,16 @@ s = symbol_calloc(id); if (storage_class & STCout) - t = type_fake(TYnptr); + { + if (global.params.symdebug && storage_class & STCparameter) + { + t = type_alloc(TYref); + t->Tnext = type->toCtype(); + t->Tnext->Tcount++; + } + else + t = type_fake(TYnptr); + } else if (storage_class & STClazy) t = type_fake(TYullong); // Tdelegate as C type else if (isParameter()) @@ -276,6 +285,14 @@ /************************************* */ +Symbol *FuncAliasDeclaration::toSymbol() +{ + return funcalias->toSymbol(); +} + +/************************************* + */ + Symbol *FuncDeclaration::toSymbol() { if (!csym) @@ -288,7 +305,7 @@ #else id = mangle(); #endif - //printf("FuncDeclaration::toSymbol(%s)\n", toChars()); + //printf("FuncDeclaration::toSymbol(%s %s)\n", kind(), toChars()); //printf("\tid = '%s'\n", id); //printf("\ttype = %s\n", type->toChars()); s = symbol_calloc(id); @@ -300,10 +317,15 @@ symbol_func(s); f = s->Sfunc; f->Fstartline.Slinnum = loc.linnum; + f->Fstartline.Sfilename = loc.filename; if (endloc.linnum) - f->Fendline.Slinnum = endloc.linnum; + { f->Fendline.Slinnum = endloc.linnum; + f->Fendline.Sfilename = endloc.filename; + } else - f->Fendline.Slinnum = loc.linnum; + { f->Fendline.Slinnum = loc.linnum; + f->Fendline.Sfilename = loc.filename; + } t = type->toCtype(); } diff -uNr dmd-1.007/dmd/src/dmd/todt.c dmd-1.009/dmd/src/dmd/todt.c --- dmd-1.007/dmd/src/dmd/todt.c 2007-01-09 00:54:14.000000000 +0100 +++ dmd-1.009/dmd/src/dmd/todt.c 2007-02-23 17:56:50.000000000 +0100 @@ -425,6 +425,7 @@ { #ifdef DEBUG printf("Expression::toDt() %d\n", op); + dump(0); #endif error("non-constant expression %s", toChars()); pdt = dtnzeros(pdt, 1); diff -uNr dmd-1.007/dmd/src/phobos/std/path.d dmd-1.009/dmd/src/phobos/std/path.d --- dmd-1.007/dmd/src/phobos/std/path.d 2007-02-20 20:21:58.000000000 +0100 +++ dmd-1.009/dmd/src/phobos/std/path.d 2007-02-27 18:45:28.000000000 +0100 @@ -76,9 +76,9 @@ * */ -version (Windows) alias std.string.cmp fcmp; +version (Windows) alias std.string.icmp fcmp; -version (linux) alias std.string.icmp fcmp; +version (linux) alias std.string.cmp fcmp; /************************** * Extracts the extension from a filename or path. diff -uNr dmd-1.007/dmd/src/phobos/std/string.d dmd-1.009/dmd/src/phobos/std/string.d --- dmd-1.007/dmd/src/phobos/std/string.d 2007-02-20 20:21:58.000000000 +0100 +++ dmd-1.009/dmd/src/phobos/std/string.d 2007-02-27 18:45:28.000000000 +0100 @@ -1218,7 +1218,7 @@ unittest { - debug(string) printf("string.join.split1\n"); + debug(string) printf("string.split1\n"); char[] s = " peter paul\tjerry "; char[][] words; @@ -1342,7 +1342,7 @@ unittest { - debug(string) printf("string.join.split2\n"); + debug(string) printf("string.split2\n"); char[] s = ",peter,paul,jerry,"; char[][] words; @@ -1465,7 +1465,7 @@ unittest { - debug(string) printf("string.join.splitlines\n"); + debug(string) printf("string.splitlines\n"); char[] s = "\rpeter\n\rpaul\r\njerry\n"; char[][] lines;