Mercurial > projects > ldc
comparison lphobos/typeinfo1/ti_delegate.d @ 58:2c3cd3596187 trunk
[svn r62] Added support for TypeInfo _Array, _Function, _Pointer, _Delegate, _Enum
Added initial support for CatExp aka 'a ~ b'
Fixed global constant static arrays initialized with string literals
Fixed casting any dynamic array to void*
Fixed new expression with temporary storage
Fixed alias declarations in function scope
Fixed relational comparisons of pointers
author | lindquist |
---|---|
date | Thu, 25 Oct 2007 09:02:55 +0200 |
parents | lphobos/typeinfo/ti_delegate.d@06ccc817acd4 |
children |
comparison
equal
deleted
inserted
replaced
57:a9d29e9f1fed | 58:2c3cd3596187 |
---|---|
1 | |
2 // delegate | |
3 | |
4 module typeinfo1.ti_delegate; | |
5 | |
6 alias void delegate(int) dg; | |
7 | |
8 class TypeInfo_D : TypeInfo | |
9 { | |
10 hash_t getHash(void *p) | |
11 { long l = *cast(long *)p; | |
12 | |
13 return cast(uint)(l + (l >> 32)); | |
14 } | |
15 | |
16 int equals(void *p1, void *p2) | |
17 { | |
18 return *cast(dg *)p1 == *cast(dg *)p2; | |
19 } | |
20 | |
21 size_t tsize() | |
22 { | |
23 return dg.sizeof; | |
24 } | |
25 | |
26 void swap(void *p1, void *p2) | |
27 { | |
28 dg t; | |
29 | |
30 t = *cast(dg *)p1; | |
31 *cast(dg *)p1 = *cast(dg *)p2; | |
32 *cast(dg *)p2 = t; | |
33 } | |
34 | |
35 uint flags() | |
36 { | |
37 return 1; | |
38 } | |
39 } | |
40 |