Re: Return doesn't really return

2012-08-05 Thread Jacob Carlborg
On 2012-08-04 22:01, Timon Gehr wrote: Return the exit code by reference: Pass a tuple of delegate and return value to the visitorFunction per the CXClientData pointer and make the visitorFunction store the exit code inside the return code field. Then return that from opApply. That worked, tha

Re: Return doesn't really return

2012-08-04 Thread Timon Gehr
On 08/04/2012 08:54 PM, Jacob Carlborg wrote: On 2012-08-04 19:08, Timon Gehr wrote: int opApply (Delegate dg) { auto result = clang_visitChildren(cursor, &visitorFunction,cast(CXClientData) &dg); return result == CXChildVisitResult.CXChildVisit_Break ? 1 : 0; // culprit } Yes, ri

Re: Return doesn't really return

2012-08-04 Thread Jacob Carlborg
On 2012-08-04 19:08, Timon Gehr wrote: int opApply (Delegate dg) { auto result = clang_visitChildren(cursor, &visitorFunction,cast(CXClientData) &dg); return result == CXChildVisitResult.CXChildVisit_Break ? 1 : 0; // culprit } Yes, right. I forgot about that. The Clang API doesn't r

Re: Return doesn't really return

2012-08-04 Thread Timon Gehr
On 08/04/2012 06:23 PM, Jacob Carlborg wrote: I have a piece of code that looks like this: https://github.com/jacob-carlborg/dstep/blob/master/clang/Visitor.d#L168 If I change that "first" function to look like this: @property ParamCursor first () { assert(any, "Cannot get the first parameter

Re: Return doesn't really return

2012-08-04 Thread Andrej Mitrovic
On 8/4/12, Jacob Carlborg wrote: > Have I done a mistake somewhere or is this a bug in DMD? Could be related to: http://d.puremagic.com/issues/show_bug.cgi?id=7453 IOW, maybe your opApply function needs fixing?

Return doesn't really return

2012-08-04 Thread Jacob Carlborg
I have a piece of code that looks like this: https://github.com/jacob-carlborg/dstep/blob/master/clang/Visitor.d#L168 If I change that "first" function to look like this: @property ParamCursor first () { assert(any, "Cannot get the first parameter of an empty parameter list"); foreac