On Thu, Jan 31, 2008 at 03:05:17AM -0800, Klaas-Jan Stol wrote:
> # New Ticket Created by Klaas-Jan Stol
> # Please include the string: [perl #50424]
> # in the subject line of all future correspondence about this issue.
> # <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=50424 >
>
> as far as I could see, it is not allowed to create empty PAST::Stmts nodes.
> (I might have done something else wrong, but I could not find any other
> reason).
>
> If such a node is left empty, then incorrect PIR is generated:
>
> "set $P, "
>
> Note the missing second operand.
Actually, the problem isn't with the empty PAST::Stmts node but
rather with the parent node (e.g., an 'if' PAST::Op node) wanting
a result value from the PAST::Stmts node and getting an empty
string.
I can see two solutions:
(1) make the parent nodes such as PAST::Op 'if' a little smarter
so that they know what to do when the child node doesn't have
a result value
(2) when an empty PAST::Stmts node is requested to provide a return
value, have it generate a null PMC as the result
#1 will provide slightly more optimal code, because we won't be
generating null values that ultimately don't get used. #2 will
cause things to "always work" as far as the PIR is concerned, but make
it harder to produce the optimal code that #1 can generate.
Pm
Thread Previous