Mercurial > projects > ldc
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 | |
14 | |
15 /** | |
16 * | |
17 */ | |
18 void _d_invariant(Object o) | |
19 { ClassInfo c; | |
20 | |
21 //printf("__d_invariant(%p)\n", o); | |
22 | |
23 // BUG: needs to be filename/line of caller, not library routine | |
24 assert(o !is null); // just do null check, not invariant check | |
25 | |
26 c = o.classinfo; | |
27 do | |
28 { | |
29 if (c.classInvariant) | |
30 { | |
31 (*c.classInvariant)(o); | |
32 } | |
33 c = c.base; | |
34 } while (c); | |
35 } |