[perl #48445] [TODO] [NQP] - report undeclared variable usage
Will Coleda
will at coleda.com
Mon Dec 1 15:01:22 UTC 2008
On Mon, Dec 1, 2008 at 9:52 AM, Klaas-Jan Stol via RT
<parrotbug-followup at parrotcode.org> wrote:
> On Thu Jun 26 20:16:45 2008, coke wrote:
>> On Mon Dec 10 11:49:08 2007, pmichaud wrote:
>> >
>> > When an NQP program uses a variable that hasn't been
>> > previously declared, it should report a useful error message:
>> >
>> > Use of undeclared variable '$x' at ...
>> >
>> > Pm
>
> Currently it report this:
>
> C:\[...]\parrot>parrot compilers\nqp\nqp.pbc
>> $x := 1;
> Scope not found for PAST::Var '$x'
>>
>
> Is that good enough?
> Maybe the line can be reported as well?
>
>>
>> Looking at this, there doesn't seem to be a way to write a self-hosted
>> test (in nqp) for this
>> since there's no try/catch equivalent.
>>
>> Can someone add a PIR based TODO test for this (in compilers/nqp/t)
>> that shows the desired
>> (but not yet implemented) behavior?
>
> I'm not sure what is suggested here, or how to do it.
>
>
> kjs
NQP tests are written in NQP: So far as I can tell, there's no way to
catch the error that we want to insure is there. The easiest way I
could think of was to write the test in PIR, where we could invoke
NQP, but wrap the call in an exception handler, make sure it looked
like what we wanted, and then report success.
--
Will "Coke" Coleda
More information about the parrot-dev
mailing list