Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Refactor handling of block references in methods.
  • Loading branch information
pmichaud committed Jul 4, 2010
1 parent 491127a commit f0cf54e
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/Perl6/Actions.pm
Expand Up @@ -1238,7 +1238,7 @@ method method_def($/) {
0;

# Create code object using a reference to $past.
my $code := block_code($past, $*METHODTYPE, $multi_flag);
my $code := block_closure(blockref($past), $*METHODTYPE, $multi_flag);

# Get hold of the correct table to install it in, and install.
our @PACKAGE;
Expand All @@ -1256,7 +1256,7 @@ method method_def($/) {
$/.CURSOR.panic('Can not put ' ~ $*MULTINESS ~ ' on anonymous routine');
}
else {
$past := create_code_object($past, $*METHODTYPE, 0);
$past := block_closure($past, $*METHODTYPE, 0);
}

make $past;
Expand Down Expand Up @@ -2752,6 +2752,14 @@ sub get_nearest_signature() {
Perl6::Compiler::Signature.new()
}


sub blockref($block) {
my $ref := PAST::Val.new( :value($block) );
$ref<block_past> := $block;
$ref<lazysig> := $block<lazysig>;
$ref;
}

# Returns the (static) code object for a block.
# Note that it never holds the block directly -- it's always
# obtained by reference.
Expand Down

0 comments on commit f0cf54e

Please sign in to comment.