sub up {
my ($self, $frames) = @_;
+ my $cxt;
if (Scalar::Util::blessed($self)) {
$self->assert_valid;
+ $cxt = $self->cxt;
} else {
- $self = $self->new(Scope::Upper::UP(Scope::Upper::SUB()));
+ $cxt = Scope::Upper::UP(Scope::Upper::SUB());
}
$frames = 1 unless defined $frames;
- my $cxt = $self->cxt;
$cxt = Scope::Upper::UP($cxt) for 1 .. $frames;
$self->new($cxt);
sub sub {
my ($self, $frames) = @_;
+ my $cxt;
if (Scalar::Util::blessed($self)) {
$self->assert_valid;
+ $cxt = $self->cxt;
} else {
- $self = $self->new(Scope::Upper::UP(Scope::Upper::SUB()));
+ $cxt = Scope::Upper::UP(Scope::Upper::SUB());
}
$frames = 0 unless defined $frames;
- my $cxt = Scope::Upper::SUB($self->cxt);
+ $cxt = Scope::Upper::SUB($cxt);
$cxt = Scope::Upper::SUB(Scope::Upper::UP($cxt)) for 1 .. $frames;
$self->new($cxt);
sub eval {
my ($self, $frames) = @_;
+ my $cxt;
if (Scalar::Util::blessed($self)) {
$self->assert_valid;
+ $cxt = $self->cxt;
} else {
- $self = $self->new(Scope::Upper::UP(Scope::Upper::SUB()));
+ $cxt = Scope::Upper::UP(Scope::Upper::SUB());
}
$frames = 0 unless defined $frames;
- my $cxt = Scope::Upper::EVAL($self->cxt);
+ $cxt = Scope::Upper::EVAL($cxt);
$cxt = Scope::Upper::EVAL(Scope::Upper::UP($cxt)) for 1 .. $frames;
$self->new($cxt);