Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
POST block gets $_ set to the result.
  • Loading branch information
jnthn committed Mar 18, 2012
1 parent 924712d commit 8f4a063
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
15 changes: 15 additions & 0 deletions src/Perl6/World.pm
Expand Up @@ -1272,6 +1272,21 @@ class Perl6::World is HLL::World {
)
),
);

if $phaser eq 'POST' {
# Needs $_ that can be set to the return value.
$phaser_past[0].unshift(PAST::Op.new( :pirop('bind_signature v') ));
unless $phaser_past.symbol('$_') {
$phaser_past[0].unshift(PAST::Var.new( :name('$_'), :scope('lexical_6model'), :isdecl(1) ));
}
nqp::push(
nqp::getattr($block.signature, self.find_symbol(['Signature']), '$!params'),
self.create_parameter(hash(
variable_name => '$_', is_parcel => 1,
nominal_type => self.find_symbol(['Mu'])
)));
}

@!CODES[+@!CODES - 1].add_phaser($phaser, $block);
return PAST::Var.new(:name('Nil'), :scope('lexical_6model'));
}
Expand Down
2 changes: 1 addition & 1 deletion src/ops/perl6.ops
Expand Up @@ -147,7 +147,7 @@ static PMC *run_leave_phasers(PARROT_INTERP, PMC *ctx, PMC *perl6_code, PMC *res
} else {
PMC *phaser = VTABLE_get_pmc_keyed_int(interp, post_phasers, i);
Parrot_ex_add_c_handler(interp, &jump_point);
Parrot_pcc_invoke_sub_from_c_args(interp, phaser, "->");
Parrot_pcc_invoke_sub_from_c_args(interp, phaser, "P->", result);
}
Parrot_cx_delete_handler_local(interp);
}
Expand Down

0 comments on commit 8f4a063

Please sign in to comment.