Mercurial > projects > dil
comparison trunk/src/dil/SyntaxTree.d @ 516:433d51c18524
Renamed template Cast to TryCast.
author | Aziz K?ksal <aziz.koeksal@gmail.com> |
---|---|
date | Fri, 14 Dec 2007 22:43:44 +0100 |
parents | b60450804b6e |
children | c9579ea87228 |
comparison
equal
deleted
inserted
replaced
515:7cb97346bc6f | 516:433d51c18524 |
---|---|
218 } | 218 } |
219 | 219 |
220 /// This string is mixed into the constructor of a class that inherits from Node. | 220 /// This string is mixed into the constructor of a class that inherits from Node. |
221 const string set_kind = `this.kind = mixin("NodeKind." ~ typeof(this).stringof);`; | 221 const string set_kind = `this.kind = mixin("NodeKind." ~ typeof(this).stringof);`; |
222 | 222 |
223 Class Cast(Class)(Node n) | 223 Class TryCast(Class)(Node n) |
224 { | 224 { |
225 assert(n !is null); | 225 assert(n !is null); |
226 if (n.kind == mixin("NodeKind." ~ typeof(Class).stringof)) | 226 if (n.kind == mixin("NodeKind." ~ typeof(Class).stringof)) |
227 return cast(Class)cast(void*)n; | 227 return cast(Class)cast(void*)n; |
228 return null; | 228 return null; |