Wiki Roadmap Timeline Tickets New Ticket Source Search Help / Guide About Trac Login

root/runtime/internal/invariant.d

Revision 1440:d7ec997de427, 0.5 kB (checked in by Frits van Bommel <fvbommel wxs.nl>, 3 years ago)

Adjust runtime for recent ABI change on x86-64, since member functions are no
longer equivalent to regular functions with this as their first argument.
(They weren't anyway, but it happened to work as long as there was no sret
parameter)

Line 
1 /*
2  * Placed into the Public Domain
3  * written by Walter Bright
4  * www.digitalmars.com
5  */
6
7 extern(C) void _d_invariant(Object o)
8 {   ClassInfo c;
9
10     //printf("__d_invariant(%p)\n", o);
11
12     // BUG: needs to be filename/line of caller, not library routine
13     assert(o !is null); // just do null check, not invariant check
14
15     c = o.classinfo;
16     do
17     {
18     if (c.classInvariant)
19     {
20         void delegate() inv;
21         inv.ptr = cast(void*) o;
22         inv.funcptr = c.classInvariant;
23         inv();
24     }
25     c = c.base;
26     } while (c);
27 }
Note: See TracBrowser for help on using the browser.
Copyright © 2008, LDC Development Team.