Skip to content

Commit

Permalink
The implicit *%_ for methods should be in the Signature object too. P…
Browse files Browse the repository at this point in the history
…lus a little code re-ordering so the signature is set up early enough for us to do this.
  • Loading branch information
jnthn committed Jun 29, 2009
1 parent d3e040f commit 6c7e546
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/parser/actions.pm
Expand Up @@ -838,6 +838,10 @@ method method_def($/) {
$block.name( $name );
}

$block.control(return_handler_past());
block_signature($block);
$block<default_param_type_node>.name('Any');

# Add lexical 'self' and a slot for the candidate dispatcher list.
$block[0].unshift(
PAST::Var.new( :name('self'), :scope('lexical'), :isdecl(1),
Expand All @@ -855,11 +859,16 @@ method method_def($/) {
}
if $need_slurpy_hash {
$block[0].push(PAST::Var.new( :name('%_'), :scope('parameter'), :named(1), :slurpy(1) ));
$block.loadinit().push(PAST::Op.new(
:pasttype('callmethod'),
:name('!add_param'),
PAST::Var.new( :name('signature'), :scope('register') ),
PAST::Val.new( :value('%_') ),
PAST::Val.new( :value(1), :named('named') ),
PAST::Val.new( :value(1), :named('slurpy') )
));
}

$block.control(return_handler_past());
block_signature($block);
$block<default_param_type_node>.name('Any');
# Ensure there's an invocant in the signature.
$block.loadinit().push(PAST::Op.new(
:pasttype('callmethod'),
Expand Down

0 comments on commit 6c7e546

Please sign in to comment.