Hi,

does the attached test use the Continuation in a correct way?
The test failes, what am I doing wrong?

jens
use strict;

use Parrot::Test tests => 1;

output_is(<<'CODE', <<'OUTPUT', "use a continuation to go down the callchain");
##PIR##
.sub _main
    .local int a
    .local int b
    .local int c
    a = 1
    b = 2
    c = 3
    _func()
    print "123="
    print a
    print b
    print c
    print "\n"
    end
.end

.sub _func
    .local pmc conti
    .local int a
    .local int b
    .local int c
    
    
    a = 4
    b = 5
    c = 6

    newsub conti, .Continuation, _end
    
    _do_something( conti )
    
_end:
    print "456="
    print a
    print b
    print c
    print "\n"
    .pcc_begin_return
    .pcc_end_return
.end

.sub _do_something
    .param pmc conti
    .local int a
    .local int b
    .local int c
    
    a = 7
    b = 8
    c = 9
    
    invoke conti

    print "error!\n"
    print "789="
    print a
    print b
    print c
    print "\n"
    
    .pcc_begin_return
    .pcc_end_return
.end
CODE
456=456
123=123
OUTPUT

Reply via email to