Mercurial > projects > dang
diff ast/Decl.d @ 82:06dda301ea61 new_gen
Can declare outside functions and call c-functions
author | Anders Johnsen <skabet@gmail.com> |
---|---|
date | Fri, 02 May 2008 19:51:58 +0200 |
parents | 91f10c34cd7b |
children | 29f486ccc203 |
line wrap: on
line diff
--- a/ast/Decl.d Fri May 02 18:23:33 2008 +0200 +++ b/ast/Decl.d Fri May 02 19:51:58 2008 +0200 @@ -52,7 +52,10 @@ override DType type() { - return env.find(identifier).type; + if(identifier) + return env.find(identifier).type; + else + return env.findType(varType); } Identifier varType, identifier; @@ -68,7 +71,7 @@ this.identifier = identifier; } - void addParam(Identifier type, Identifier name) + void addParam(Identifier type, Identifier name = null) { funcArgs ~= new VarDecl(type, name, null); } @@ -76,6 +79,7 @@ void setBody(CompoundStatement stmts) { statements = stmts.statements; + emptyFunction = false; } void simplify() @@ -129,6 +133,7 @@ VarDecl[] funcArgs; Stmt[] statements; bool sret = false; + bool emptyFunction = true; private DFunction myType; }