#500: :init sub cannot be target of :outer
----------------------+-----------------------------------------------------
Reporter: pmichaud | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: none | Version:
Severity: medium | Keywords:
Lang: | Patch:
Platform: |
----------------------+-----------------------------------------------------
(This ticket was originally RT #47956)
Currently the PIR compiler cannot handle :outer flags pointing to a Sub
with the :init flag on it.
Running from the command line works:
{{{
$ cat x.pir
.sub 'MAIN'
say 'MAIN'
.return ()
.end
.namespace ['XYZ']
.sub 'BEGIN' :init
say 'XYZ::BEGIN'
.return ()
.end
.sub 'foo' :outer('BEGIN')
say 'XYZ::foo'
.return ()
.end
$ ./parrot x.pir
XYZ::BEGIN
MAIN
$
}}}
Loading the text into a string and compiling that (via "compreg PIR")
fails:
{{{
$ ./parrot y.pir
compiler start
reading x.pir into $S0
.sub 'MAIN'
say 'MAIN'
.return ()
.end
.namespace ['XYZ']
.sub 'BEGIN' :init
say 'XYZ::BEGIN'
.return ()
.end
.sub 'foo' :outer('BEGIN')
say 'XYZ::foo'
.return ()
.end
compiling (but not running) $S0
XYZ::BEGIN
src/call/pcc.c:562: failed assertion '(sig_pmc)->vtable->base_type ==
enum_class_FixedIntegerArray'
Backtrace - Obtained 31 stack frames (max trace depth is 32).
(unknown)
Parrot_confess
Parrot_init_arg_indexes_and_sig_pmc
parrot_pass_args
Parrot_Continuation_invoke
Parrot_returncc
(unknown)
(unknown)
(unknown)
(unknown)
Parrot_runops_fromc_args
(unknown)
(unknown)
do_sub_pragmas
PackFile_fixup_subs
(unknown)
(unknown)
(unknown)
Parrot_NCI_invoke
Parrot_invokecc_p
(unknown)
(unknown)
(unknown)
(unknown)
Parrot_runops_fromc_args
Parrot_runcode
(unknown)
imcc_run
(unknown)
__libc_start_main
(unknown)
Aborted
$
}}}
(Note that it's the _compilation_ that fails.)
This ends up blocking a number of items in Rakudo -- most notably the
ability for methods to access lexicals in an outer scope.
Pm
--
Ticket URL: <https://trac.parrot.org/parrot/ticket/500>
Parrot <https://trac.parrot.org/parrot/>
Parrot Development
_______________________________________________
parrot-tickets mailing list
[email protected]
http://lists.parrot.org/mailman/listinfo/parrot-tickets