"next()" Creates bad PIR #5

Open
Whiteknight opened this Issue Jun 27, 2010 · 1 comment

Comments

Projects
None yet
2 participants
@Whiteknight

http://gist.github.com/455249

In this gist, the keyword "next" is called like a function with "next()". I'm not sure if this would be valid Perl6 or not, but the generated PIR has this snippet:

set $I13, .CONTROL_LOOP_NEXT
die 0, $I13
$P14 = ()

This is a PIR parse error and Parrot barfs over it.

@arnsholt

This comment has been minimized.

Show comment Hide comment
@arnsholt

arnsholt Jun 28, 2010

Member

The cause of this issue is, as far as I can make out, that the loop control primitives are implemented as special instances of term:sym<> that generate custom PAST. When those terms are followed by a postcircumfix:sym<( )>, things go a bit pear-shaped.

I think the problem is that method postcircumfix<( )> in Actions.pm generates a call op, but it looks like term:sym suppresses the setting of the invocant, which creates the $P14 = () code (which should really be $P14 = "foo"() or somesuch).

A quick fix that works for me locally is to add `[ '(' ~ ')' <.arglist>]? to term:sym, but it's most likely not an ideal fix.

Member

arnsholt commented Jun 28, 2010

The cause of this issue is, as far as I can make out, that the loop control primitives are implemented as special instances of term:sym<> that generate custom PAST. When those terms are followed by a postcircumfix:sym<( )>, things go a bit pear-shaped.

I think the problem is that method postcircumfix<( )> in Actions.pm generates a call op, but it looks like term:sym suppresses the setting of the invocant, which creates the $P14 = () code (which should really be $P14 = "foo"() or somesuch).

A quick fix that works for me locally is to add `[ '(' ~ ')' <.arglist>]? to term:sym, but it's most likely not an ideal fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment