Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Improve handling of my @x in subs
  • Loading branch information
sorear committed Jul 20, 2010
1 parent fa2393d commit 7b4cabe
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions CgOp.pm
Expand Up @@ -313,12 +313,13 @@ use warnings;
lexput(0, $_[0], protolget($_[0])));
}

# this will need changing once @vars are implemented... or maybe something
# entirely different, I think cloning at all may be wrong
# the handling of @var here is quite wrong, but works for now
sub copy_lex {
my ($n, $l) = @_;
prog(
lextypes($_[0], 'Variable'),
lexput(0, $_[0], newrwscalar(fetch(protolget($_[0])))));
lextypes($n, 'Variable'),
lexput(0, $n, $l ? newrwlistvar(fetch(protolget($_[0])))
: newrwscalar(fetch(protolget($_[0])))));
}

sub clone_lex {
Expand Down
2 changes: 1 addition & 1 deletion Decl.pm
Expand Up @@ -123,7 +123,7 @@ use CgOp;

$body->mainline ?
CgOp::share_lex($self->slot) :
CgOp::copy_lex($self->slot);
CgOp::copy_lex($self->slot, $self->list);
}

sub write {
Expand Down

0 comments on commit 7b4cabe

Please sign in to comment.