diff --git a/src/Perl6/Actions.pm b/src/Perl6/Actions.pm index a5d55a8fbb8..9c310d873ad 100644 --- a/src/Perl6/Actions.pm +++ b/src/Perl6/Actions.pm @@ -965,7 +965,8 @@ method method_def($/) { $past.name($name); $past.nsentry(''); my $multi_flag := PAST::Val.new( :value(0) ); - $past := create_code_object($past, $*METHODTYPE, $multi_flag, $sig_setup_block); + # create code object using a reference to $past + my $code := create_code_object(PAST::Val.new(:value($past)), $*METHODTYPE, $multi_flag, $sig_setup_block); # Get hold of methods table. our @PACKAGE; @@ -991,30 +992,30 @@ method method_def($/) { } # If it's a proto, stash it away in the symbol entry. - if $*MULTINESS eq 'proto' { %table{$name} := $past; } + if $*MULTINESS eq 'proto' { %table{$name} := $code; } # Otherwise, create multi container if we don't have one; otherwise, # just push this candidate onto it. if %table{$name} { - %table{$name}.push($past); + %table{$name}.push($code); } else { - $past := PAST::Op.new( + $code := PAST::Op.new( :pasttype('callmethod'), :name('set_candidates'), PAST::Op.new( :inline(' %r = new ["Perl6MultiSub"]') ), - $past + $code ); - %table{$name} := %table{$name} := $past; + %table{$name} := %table{$name} := $code; } $multi_flag.value($*MULTINESS eq 'proto' ?? 2 !! 1); } else { - %table{$name} := $past; + %table{$name} := $code; } # Added via meta-class; needn't add anything. - $past := PAST::Stmts.new(); + # $past := PAST::Stmts.new(); } elsif $*MULTINESS { $/.CURSOR.panic('Can not put ' ~ $*MULTINESS ~ ' on anonymous routine');