Skip to content
This repository has been archived by the owner on Feb 3, 2021. It is now read-only.

"next()" Creates bad PIR #5

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

"next()" Creates bad PIR #5

Whiteknight opened this issue Jun 27, 2010 · 1 comment

Comments

@Whiteknight
Copy link

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
Copy link
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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants