comparison runtime/internal/invariant.d @ 530:d30c40f1128d

Make class invariants work.
author Christian Kamm <kamm incasoftware de>
date Thu, 21 Aug 2008 15:19:45 +0200
parents
children d7ec997de427
comparison
equal deleted inserted replaced
529:cef0cbcf7d22 530:d30c40f1128d
1
2 /*
3 * Placed into the Public Domain
4 * written by Walter Bright
5 * www.digitalmars.com
6 */
7
8 extern(C) void _d_invariant(Object o)
9 { ClassInfo c;
10
11 //printf("__d_invariant(%p)\n", o);
12
13 // BUG: needs to be filename/line of caller, not library routine
14 assert(o !is null); // just do null check, not invariant check
15
16 c = o.classinfo;
17 do
18 {
19 if (c.classInvariant)
20 {
21 (*c.classInvariant)(o);
22 }
23 c = c.base;
24 } while (c);
25 }