Mercurial > projects > dang
diff sema/ScopeBuilder.d @ 176:dc9bf56b7ace
Can now use & as a unary operator and take an AddressOf
author | Anders Johnsen <skabet@gmail.com> |
---|---|
date | Thu, 24 Jul 2008 23:03:18 +0200 |
parents | 01c2c49775ef |
children | 29324df1d649 |
line wrap: on
line diff
--- a/sema/ScopeBuilder.d Thu Jul 24 21:12:12 2008 +0200 +++ b/sema/ScopeBuilder.d Thu Jul 24 23:03:18 2008 +0200 @@ -134,7 +134,7 @@ d.returnType = typeOf(i.returnType, sc); foreach (decl ; i.decls) d.params ~= typeOf(decl.varType, sc); - return d; + return d.getPointerTo; } return sc.findType(id.get); } @@ -247,13 +247,20 @@ } } - DType typeOf(Identifier id, Scope sc) { if(auto i = cast(PointerTypeExp)id) return (typeOf(i.pointerOf, sc)).getPointerTo(); else if(auto i = cast(StaticArrayTypeExp)id) return typeOf(i.arrayOf, sc).getAsStaticArray(i.size); + else if(auto i = cast(FunctionTypeExp)id) + { + auto d = new DFunction(id); + d.returnType = typeOf(i.returnType, sc); + foreach (decl ; i.decls) + d.params ~= typeOf(decl.varType, sc); + return d.getPointerTo; + } return sc.findType(id.get); }