Mercurial > projects > dang
diff ast/Decl.d @ 60:2451f0904bf6 new_gen
Dumping Ast with AstPrinter is now possible again! :)
author | Anders Johnsen <skabet@gmail.com> |
---|---|
date | Tue, 29 Apr 2008 15:00:11 +0200 |
parents | 4ae365eff712 |
children | 9f8131676242 |
line wrap: on
line diff
--- a/ast/Decl.d Tue Apr 29 00:31:56 2008 +0200 +++ b/ast/Decl.d Tue Apr 29 15:00:11 2008 +0200 @@ -71,20 +71,25 @@ void simplify() { - if(auto t = cast(DStruct)env.find(identifier).type) + if(auto t = cast(DFunction)env.find(identifier).type) { - VarDecl[] funcArgs; - auto i = new Identifier("ret.val"); - i.env = env; - i.env.add(i); - i.env.find(i).type = i.env.find(identifier).type; - auto var = new VarDecl(type, i); - var.env = env; - funcArgs ~= var; - funcArgs ~= this.funcArgs; - this.funcArgs = funcArgs; - env.find(this.identifier).type = DType.Void; - sret = true; + if(auto s = cast(DStruct)t.return_type) + { + VarDecl[] funcArgs; + auto i = new Identifier("ret.val"); + i.env = env; + i.env.add(i); + i.env.find(i).type = s; + auto var = new VarDecl(type, i); + var.env = env; + funcArgs ~= var; + funcArgs ~= this.funcArgs; + this.funcArgs = funcArgs; + t.return_type = DType.Void; + this.type = new Identifier("void"); + env.find(identifier).type = t; + sret = true; + } } foreach ( funcArg ; funcArgs )