Mercurial > projects > dang
diff gen/CodeGen.d @ 53:da551f90e03f new_gen
Added struct decl and forward ref. A note on structs: they need to make a new scope when declared. Otherwise you could access struct members as globals
author | Anders Johnsen <skabet@gmail.com> |
---|---|
date | Sat, 26 Apr 2008 18:52:27 +0200 |
parents | 6decab6f45c4 |
children | d84fec04d462 |
line wrap: on
line diff
--- a/gen/CodeGen.d Sat Apr 26 16:12:36 2008 +0200 +++ b/gen/CodeGen.d Sat Apr 26 18:52:27 2008 +0200 @@ -568,6 +568,17 @@ type_map[t] = res; return res; } + if (auto s = cast(DStruct)t) + { + Type[] members; + foreach(m; s.members) + members ~= llvm(m); + + + Type res = StructType.Get(members); + type_map[t] = res; + return res; + } assert(0, "Only integers are supported"); }