Mercurial > projects > dang
diff sema/SymbolTableBuilder.d @ 59:1d6f4ad38a91 new_gen
Make most of the tests pass again
Still have two bugs, one is that type conversion has been diabled for
return statements, the other is at line ~540 of CodeGen.d, were the
following error is emitted:
Can't find an implicit conversion between { i32 } and i32
author | Anders Halager <halager@gmail.com> |
---|---|
date | Tue, 29 Apr 2008 00:31:56 +0200 |
parents | 4ae365eff712 |
children | 9f8131676242 |
line wrap: on
line diff
--- a/sema/SymbolTableBuilder.d Mon Apr 28 21:51:39 2008 +0200 +++ b/sema/SymbolTableBuilder.d Tue Apr 29 00:31:56 2008 +0200 @@ -6,7 +6,8 @@ public import sema.SymbolTable; -import sema.Visitor; +import sema.Visitor, + basic.SmallArray; class SymbolTableBuilder : Visitor!(void) { @@ -20,13 +21,23 @@ override void visitFuncDecl(FuncDecl d) { - d.env.find(d.identifier).type = typeOf(d.type, d.env); visitExp(d.type); visitExp(d.identifier); + SmallArray!(DType, 8) arg_types; foreach (arg; d.funcArgs) + { visitDecl(arg); + arg_types ~= d.env.find(arg.identifier).type; + } foreach (stmt; d.statements) visitStmt(stmt); + + auto func_t = new DFunction(d.identifier); + func_t.return_type = d.env.findType(d.type); + func_t.params = arg_types.safe(); + + auto sym = d.env.find(d.identifier); + sym.type = func_t; } override void visitVarDecl(VarDecl d)