Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
multis and methods get a slot for a dispatcher, which just contains a…
… type object; we'll vivify it on demand to create a real dispatcher if nextsame et al are used.
  • Loading branch information
jnthn committed Jul 10, 2011
1 parent b02654b commit 0cd9e67
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/Perl6/Actions.pm
Expand Up @@ -1111,6 +1111,13 @@ class Perl6::Actions is HLL::Actions {
set_default_parameter_type(@params, 'Any');
my $signature := create_signature_object(@params, $block);
add_signature_binding_code($block, $signature, @params);

# If it's a multi, needs a slot that can hold an (unvivified)
# dispatcher.
if $*MULTINESS eq 'multi' {
$*ST.install_lexical_symbol($block, '$*DISPATCHER', $*ST.find_symbol(['MultiDispatcher']));
$block[0].unshift(PAST::Op.new(:pirop('perl6_take_dispatcher v')));
}

# Create code object.
if $<deflongname> {
Expand Down Expand Up @@ -1256,6 +1263,11 @@ class Perl6::Actions is HLL::Actions {
$past[0].unshift(PAST::Var.new( :name('self'), :scope('lexical_6model'), :isdecl(1) ));
$past.symbol('self', :scope('lexical_6model'));

# Needs a slot to hold a multi or method dispatcher.
$*ST.install_lexical_symbol($past, '$*DISPATCHER',
$*ST.find_symbol([$*MULTINESS eq 'multi' ?? 'MultiDispatcher' !! 'MethodDispatcher']));
$past[0].unshift(PAST::Op.new(:pirop('perl6_take_dispatcher v')));

# Create code object.
if $<longname> {
$past.name($<longname>.Str);
Expand Down

0 comments on commit 0cd9e67

Please sign in to comment.