Mercurial > projects > ldc
view tests/mini/s.d @ 1442:0a5f7890f327
Adjust some more code that was depending on the function and delegate calling
conventions being equal.
There's also an instance in `tango.text.convert.Layout` that should be adjusted:
{{{
Index: tango/text/convert/Layout.d
===================================================================
--- tango/text/convert/Layout.d (revision 4578)
+++ tango/text/convert/Layout.d (working copy)
-660,8 +660,12 @@
case TypeCode.STRUCT:
auto s = cast(TypeInfo_Struct) type;
- if (s.xtoString)
- return Utf.fromString8 (s.xtoString(p), result);
+ if (s.xtoString) {
+ char[] delegate() toString;
+ toString.ptr = p;
+ toString.funcptr = cast(char[] function()) s.xtoString;
+ return Utf.fromString8 (toString(), result);
+ }
goto default;
case TypeCode.INTERFACE:
}}}
author | Frits van Bommel <fvbommel wxs.nl> |
---|---|
date | Sun, 31 May 2009 15:27:01 +0200 |
parents | d92acb81a583 |
children |
line wrap: on
line source
module s; interface Inter { void inter(); } interface Inter2 { void inter2(); } interface InterOne : Inter { void interOne(); } abstract class ClassAbstract : InterOne { abstract void inter(); abstract void interOne(); } class TheClassOne : ClassAbstract { void inter() { } void interOne() { } } class TheClassTwo : TheClassOne, Inter2 { long l; double d; void inter2() { } } extern(C) int printf(char*, ...); void main() { printf("classinfo test\n"); { auto c = new TheClassOne; { auto ci = c.classinfo; printf("ci = %.*s\n", ci.name.length, ci.name.ptr); printf("ci.interfaces.length = %lu\n", ci.interfaces.length); foreach (i, iface; ci.interfaces) printf("i[%d] = %.*s\n", i, iface.classinfo.name.length, iface.classinfo.name.ptr); } } { auto c = new TheClassTwo; { auto ci = c.classinfo; printf("ci = %.*s\n", ci.name.length, ci.name.ptr); printf("ci.interfaces.length = %lu\n", ci.interfaces.length); foreach (i, iface; ci.interfaces) printf("i[%d] = %.*s\n", i, iface.classinfo.name.length, iface.classinfo.name.ptr); } InterOne i = c; { auto ci = i.classinfo; printf("ci = %.*s\n", ci.name.length, ci.name.ptr); } auto i2 = cast(Inter2)c; { auto ci = i2.classinfo; printf("ci = %.*s\n", ci.name.length, ci.name.ptr); } auto o = cast(Object)i2; { auto ci = o.classinfo; printf("ci = %.*s\n", ci.name.length, ci.name.ptr); } } }