Mercurial > projects > ddmd
changeset 66:efb1e5bdf63c
more implementations
author | korDen |
---|---|
date | Mon, 23 Aug 2010 20:38:30 +0400 |
parents | 9ce5d450c318 |
children | f708f0452e81 |
files | dmd/CallExp.d dmd/Expression.d dmd/ForeachStatement.d |
diffstat | 3 files changed, 56 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/dmd/CallExp.d Mon Aug 23 20:29:38 2010 +0400 +++ b/dmd/CallExp.d Mon Aug 23 20:38:30 2010 +0400 @@ -100,9 +100,15 @@ } this(Loc loc, Expression e, Expression earg1, Expression earg2) - { - assert(false); - super(loc, TOK.init, 0, e); + { + super(loc, TOK.TOKcall, CallExp.sizeof, e); + + Expressions arguments = new Expressions(); + arguments.setDim(2); + arguments.data[0] = cast(void*)earg1; + arguments.data[1] = cast(void*)earg2; + + this.arguments = arguments; } Expression syntaxCopy()
--- a/dmd/Expression.d Mon Aug 23 20:29:38 2010 +0400 +++ b/dmd/Expression.d Mon Aug 23 20:38:30 2010 +0400 @@ -361,9 +361,12 @@ } } + /*************************************** + * Return !=0 if expression is an lvalue. + */ int isLvalue() { - assert(false); + return 0; } Expression toLvalue(Scope sc, Expression e)
--- a/dmd/ForeachStatement.d Mon Aug 23 20:29:38 2010 +0400 +++ b/dmd/ForeachStatement.d Mon Aug 23 20:38:30 2010 +0400 @@ -2,6 +2,7 @@ import dmd.Statement; import dmd.TOK; +import dmd.Token; import dmd.Loc; import dmd.LINK; import dmd.ArrayTypes; @@ -782,27 +783,39 @@ bool hasBreak() { - assert(false); + return true; } bool hasContinue() { - assert(false); + return true; } bool usesEH() { - assert(false); + return body_.usesEH(); } BE blockExit() { - assert(false); + BE result = BEfallthru; + + if (aggr.canThrow()) + result |= BEthrow; + + if (body_) + { + result |= body_.blockExit() & ~(BEbreak | BEcontinue); + } + return result; } bool comeFrom() { - assert(false); + if (body_) + return body_.comeFrom(); + + return false; } Expression interpret(InterState istate) @@ -810,9 +823,32 @@ assert(false); } - void toCBuffer(OutBuffer uf, HdrGenState* hgs) + void toCBuffer(OutBuffer buf, HdrGenState* hgs) { - assert(false); + buf.writestring(Token.toChars(op)); + buf.writestring(" ("); + for (int i = 0; i < arguments.dim; i++) + { + Argument a = cast(Argument)arguments.data[i]; + if (i) + buf.writestring(", "); + if (a.storageClass & STCref) + buf.writestring((global.params.Dversion == 1) ? "inout " : "ref "); + if (a.type) + a.type.toCBuffer(buf, a.ident, hgs); + else + buf.writestring(a.ident.toChars()); + } + buf.writestring("; "); + aggr.toCBuffer(buf, hgs); + buf.writebyte(')'); + buf.writenl(); + buf.writebyte('{'); + buf.writenl(); + if (body_) + body_.toCBuffer(buf, hgs); + buf.writebyte('}'); + buf.writenl(); } Statement inlineScan(InlineScanState* iss)