Mercurial > projects > dang
comparison 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 |
comparison
equal
deleted
inserted
replaced
175:c8e26556c24d | 176:dc9bf56b7ace |
---|---|
132 { | 132 { |
133 auto d = new DFunction(id); | 133 auto d = new DFunction(id); |
134 d.returnType = typeOf(i.returnType, sc); | 134 d.returnType = typeOf(i.returnType, sc); |
135 foreach (decl ; i.decls) | 135 foreach (decl ; i.decls) |
136 d.params ~= typeOf(decl.varType, sc); | 136 d.params ~= typeOf(decl.varType, sc); |
137 return d; | 137 return d.getPointerTo; |
138 } | 138 } |
139 return sc.findType(id.get); | 139 return sc.findType(id.get); |
140 } | 140 } |
141 | 141 |
142 Module[] modules; | 142 Module[] modules; |
245 name = fd.identifier.get; | 245 name = fd.identifier.get; |
246 }*/ | 246 }*/ |
247 } | 247 } |
248 } | 248 } |
249 | 249 |
250 | |
251 DType typeOf(Identifier id, Scope sc) | 250 DType typeOf(Identifier id, Scope sc) |
252 { | 251 { |
253 if(auto i = cast(PointerTypeExp)id) | 252 if(auto i = cast(PointerTypeExp)id) |
254 return (typeOf(i.pointerOf, sc)).getPointerTo(); | 253 return (typeOf(i.pointerOf, sc)).getPointerTo(); |
255 else if(auto i = cast(StaticArrayTypeExp)id) | 254 else if(auto i = cast(StaticArrayTypeExp)id) |
256 return typeOf(i.arrayOf, sc).getAsStaticArray(i.size); | 255 return typeOf(i.arrayOf, sc).getAsStaticArray(i.size); |
256 else if(auto i = cast(FunctionTypeExp)id) | |
257 { | |
258 auto d = new DFunction(id); | |
259 d.returnType = typeOf(i.returnType, sc); | |
260 foreach (decl ; i.decls) | |
261 d.params ~= typeOf(decl.varType, sc); | |
262 return d.getPointerTo; | |
263 } | |
257 return sc.findType(id.get); | 264 return sc.findType(id.get); |
258 } | 265 } |
259 | 266 |
260 Module current; | 267 Module current; |
261 SymbolFactory sf; | 268 SymbolFactory sf; |