145
|
1 /**
|
|
2 * Implementation of invariant support routines.
|
|
3 *
|
|
4 * Copyright: Copyright Digital Mars 2007 - 2010.
|
|
5 * License: $(WEB www.boost.org/LICENSE_1_0.txt, Boost License 1.0).
|
|
6 * Authors: Walter Bright
|
|
7 */
|
|
8
|
|
9 /* Copyright Digital Mars 2007 - 2010.
|
|
10 * Distributed under the Boost Software License, Version 1.0.
|
|
11 * (See accompanying file LICENSE or copy at
|
|
12 * http://www.boost.org/LICENSE_1_0.txt)
|
|
13 */
|
|
14
|
|
15
|
|
16 /**
|
|
17 *
|
|
18 */
|
|
19 void _d_invariant(Object o)
|
|
20 { ClassInfo c;
|
|
21
|
|
22 //printf("__d_invariant(%p)\n", o);
|
|
23
|
|
24 // BUG: needs to be filename/line of caller, not library routine
|
|
25 assert(o !is null); // just do null check, not invariant check
|
|
26
|
|
27 c = typeid(o);
|
|
28 do
|
|
29 {
|
|
30 if (c.classInvariant)
|
|
31 {
|
|
32 (*c.classInvariant)(o);
|
|
33 }
|
|
34 c = c.base;
|
|
35 } while (c);
|
|
36 }
|