Patrick R.Michaud (via RT) wrote:

Whenever a PAST::Op node gets a non-PAST child, PCT currently
throws a cryptic exception message like:

Method 'named' not found for invocant of class 'Perl6::Grammar'

A better exception message would be something like:

Perl6::Grammar ("2") child of PAST::Op cannot be converted to POST.

If you want a different exception message, you need to catch the type of the child before calling the method on it. You can call 'VTABLE_isa' if PAST nodes all share a parent, or you can call 'VTABLE_can' to check if the object can perform the method.

Though, the cheapest option may be to simply wrap non-PAST children in a PAST-compatible proxy. (That assumes that the non-PAST children are intentionally there, and aren't slipping in by mistake.)

Allison

Reply via email to