http://d.puremagic.com/issues/show_bug.cgi?id=2101
Don <[email protected]> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |patch --- Comment #3 from Don <[email protected]> 2010-01-10 14:11:14 PST --- Janice's first case has compiled for quite a long time now. The third case, involving 'new', is very straightforward. The final case (changing length) is doubtful whether it is a good idea. I think with implementing 'new', we can close this bug. PATCH to allow dynamic array creation with new. Insert this code into interpret.c, around line 2690. Also add the declaration for it in NewExp in expression.h. Also need to change the spec to remove the restriction on using 'new'. ------------ Expression *NewExp::interpret(InterState *istate) { #if LOG printf("NewExp::interpret() %s\n", toChars()); #endif if (newtype->ty == Tarray && arguments && arguments->dim == 1) { Expression *lenExpr = ((Expression *)(arguments->data[0]))->interpret(istate); if (lenExpr == EXP_CANT_INTERPRET) return EXP_CANT_INTERPRET; return createBlockDuplicatedArrayLiteral(newtype, newtype->defaultInitLiteral(), lenExpr->toInteger()); } error("Cannot interpret %s at compile time", toChars()); return EXP_CANT_INTERPRET; } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
