Migrating dmd to D?

Iain Buclaw ibuclaw at ubuntu.com
Tue Mar 12 05:26:45 PDT 2013


On 12 March 2013 02:25, Daniel Murphy <yebblies at nospamgmail.com> wrote:

> "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;
>     }
>     }
>
>
>

Yes, I know it can be cleaned up.  Just thought I might chime in on a point
I thought was amusing.


Regards
-- 
Iain Buclaw

*(p < e ? p++ : p) = (c & 0x0f) + '0';
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20130312/15955c93/attachment.html>


More information about the Digitalmars-d mailing list