Re: New reference implementation
Per Bothner 02 Oct 2015 06:07 UTC
in Kawa only
On 09/28/2015 12:55 PM, Taylan Ulrich Bayırlı/Kammer wrote:
> Per Bothner <xxxxxx@bothner.com> writes:
>
>> Some concerns:
>>
>> * I still don't see any line number information in the output.
>
> It seems to work for some forms but not all. I might need some help on
> this, here's the story:
The key to make syntax-source and syntax-line work in Kawa is to understand that
only pairs have source position info: The reader creates a PairWithPosition
object, where PairWithPosition is a subclass of Pair, which which has extra fields
for the file/line/column information from the start of the pair in the source code.
Thus:
(source-info <expr>)
only works if <expr> is a pair, which is not guaranteed. Instead you
need to call source-info the entire (test-equal ...) expression,
or some tail thereof. The following doesn't work:
(source-info #`(test-compare equals? . #,<rest>))
because that gives you the source-info of the (test-compare ...)
which is in execution.body.scm. The following would probably work:
(source-info (cddr #`(test-compare equals? . #,<rest>)))
Basically, you need to pass the <rest> list to source-info.
The attachment is one solution. It seems to work for test-equal,
and presumably other tests based on test-compare. test-assert
would need a similar re-write.
--
--Per Bothner
xxxxxx@bothner.com http://per.bothner.com/