Mercurial > projects > dang
diff ast/Stmt.d @ 139:a22e3663de89
Fixed up our simplify functions
Removed some unused stuff and changed all function calls to have () attached.
We should only omit parens when calling something that is supposed to be a
property - not a function like simplify
author | Anders Halager <halager@gmail.com> |
---|---|
date | Fri, 18 Jul 2008 13:32:34 +0200 |
parents | c3b24e7e8cf8 |
children | d76cc5cad4fc |
line wrap: on
line diff
--- a/ast/Stmt.d Fri Jul 18 13:17:02 2008 +0200 +++ b/ast/Stmt.d Fri Jul 18 13:32:34 2008 +0200 @@ -46,10 +46,10 @@ this.statements = stmts; } - void simplify() + override void simplify() { - foreach ( stmt ; statements ) - stmt.simplify; + foreach (stmt; statements ) + stmt.simplify(); } Stmt[] statements; @@ -62,12 +62,13 @@ super(StmtType.Return); } - void simplify() + // Needed? + override void simplify() { FuncDecl f = env.parentFunction; - if(exp) - exp.simplify; - if(f !is null && f.sret) + if (exp) + exp = exp.simplify(); + if (f !is null && f.sret) { auto i = new Identifier("ret.val"); i.env = f.env; @@ -85,7 +86,6 @@ stmts ~= stmt; } f.statements = stmts; - exp = null; } } @@ -101,9 +101,9 @@ this.decl = decl; } - void simplify() + override void simplify() { - decl.simplify; + decl.simplify(); } public Decl decl; @@ -117,9 +117,9 @@ this.exp = exp; } - void simplify() + override void simplify() { - exp = exp.simplify; + exp = exp.simplify(); } public Exp exp; @@ -135,12 +135,12 @@ this.else_body = el; } - void simplify() + override void simplify() { - cond.simplify; - then_body.simplify; + cond = cond.simplify(); + then_body.simplify(); if (else_body) - else_body.simplify; + else_body.simplify(); } Exp cond; @@ -157,10 +157,10 @@ this.whileBody = stmts; } - void simplify() + override void simplify() { - cond.simplify; - whileBody.simplify; + cond = cond.simplify(); + whileBody.simplify(); } Exp cond; @@ -225,14 +225,14 @@ cases[$ - 1].followedByDefault = true; } - void simplify() + override void simplify() { - cond.simplify; + cond = cond.simplify(); foreach ( stmt ; defaultBlock ) - stmt.simplify; + stmt.simplify(); foreach ( c ; cases ) foreach ( stmt ; c.stmts ) - stmt.simplify; + stmt.simplify(); } Exp cond;