comparison druntime/src/compiler/dmd/invariant_.d @ 1458:e0b2d67cfe7c

Added druntime (this should be removed once it works).
author Robert Clipsham <robert@octarineparrot.com>
date Tue, 02 Jun 2009 17:43:06 +0100
parents
children
comparison
equal deleted inserted replaced
1456:7b218ec1044f 1458:e0b2d67cfe7c
1 /**
2 * Implementation of invariant support routines.
3 *
4 * Copyright: Copyright Digital Mars 2007 - 2009.
5 * License: <a href="http://www.boost.org/LICENSE_1_0.txt>Boost License 1.0</a>.
6 * Authors: Walter Bright
7 *
8 * Copyright Digital Mars 2007 - 2009.
9 * Distributed under the Boost Software License, Version 1.0.
10 * (See accompanying file LICENSE_1_0.txt or copy at
11 * http://www.boost.org/LICENSE_1_0.txt)
12 */
13 module rt.invariant_;
14
15 extern (C) void _d_invariant(Object o)
16 { ClassInfo c;
17
18 //printf("__d_invariant(%p)\n", o);
19
20 // BUG: needs to be filename/line of caller, not library routine
21 assert(o !is null); // just do null check, not invariant check
22
23 c = o.classinfo;
24 do
25 {
26 if (c.classInvariant)
27 {
28 (*c.classInvariant)(o);
29 }
30 c = c.base;
31 } while (c);
32 }