Mercurial > projects > ddmd
diff dmd/ReturnStatement.d @ 67:f708f0452e81
some of the backend/codegen stuff implemented
author | korDen |
---|---|
date | Mon, 23 Aug 2010 21:21:05 +0400 |
parents | cab4c37afb89 |
children | ee3a9f34dc48 |
line wrap: on
line diff
--- a/dmd/ReturnStatement.d Mon Aug 23 20:38:30 2010 +0400 +++ b/dmd/ReturnStatement.d Mon Aug 23 21:21:05 2010 +0400 @@ -34,6 +34,7 @@ import dmd.VarDeclaration; import dmd.GlobalExpressions; import dmd.BE; + import dmd.codegen.Util; import dmd.backend.Blockx; @@ -44,6 +45,8 @@ import dmd.backend.mTY; import dmd.backend.BC; +import core.stdc.string; + class ReturnStatement : Statement { Expression exp; @@ -417,17 +420,15 @@ */ if (exp.op == TOK.TOKstructliteral) { - assert(false); - /* - StructLiteralExp se = cast(StructLiteralExp)exp; - char save[(StructLiteralExp).sizeof]; - memcpy(save, se, sizeof(StructLiteralExp)); + scope StructLiteralExp se = cast(StructLiteralExp)exp; + enum objectSize = __traits(classInstanceSize, StructLiteralExp); + ubyte save[objectSize]; + memcpy(save.ptr, cast(void*)se, objectSize); se.sym = irs.shidden; se.soffset = 0; se.fillHoles = 1; e = exp.toElem(irs); - memcpy(se, save, sizeof(StructLiteralExp)); - */ + memcpy(cast(void*)se, save.ptr, objectSize); } else e = exp.toElem(irs);