Migrating dmd to D?
Daniel Murphy
yebblies at nospamgmail.com
Mon Mar 11 19:25:16 PDT 2013
"Iain Buclaw" <ibuclaw at ubuntu.com> wrote in message
news:mailman.357.1363023395.14496.digitalmars-d at puremagic.com...
>
> (The D conversion seems to think it's lisp).
>
Expression resolveLoc(Loc loc, Scope sc)
{
tracein("resolveLoc");
scope(success) traceout("resolveLoc");
scope(failure) traceerr("resolveLoc");
{
FuncDeclaration fd;
if (sc.callsc && sc.callsc.func)
fd = sc.callsc.func;
else fd = sc.func;
const(char)* s;
if (fd)
{
const(char)* funcStr = fd.Dsymbol.toPrettyChars();
HdrGenState hgs;
OutBuffer buf = new OutBuffer();
functionToCBuffer2(cast(TypeFunction)fd.type, buf, &hgs, 0,
funcStr);
buf.writebyte(0);
s = cast(const(char)*)buf.extractData();
}
else {
s = "";
}
Expression e = new StringExp(loc, cast(char*)s);
e = e.semantic(sc);
e = e.castTo(sc, type);
return e;
}
}
More information about the Digitalmars-d
mailing list