Permalink
Browse files

Remove several fossils from Decl::SimpleVar

  • Loading branch information...
1 parent d7d7109 commit f6ca7b8c920aba279efeab73a24ba27d29f2d93c @sorear committed Aug 17, 2010
Showing with 17 additions and 20 deletions.
  1. +4 −0 CgOp.pm
  2. +5 −14 Decl.pm
  3. +3 −3 Niecza/Actions.pm
  4. +4 −1 Op.pm
  5. +1 −2 Sig.pm
View
@@ -392,6 +392,10 @@ use warnings;
rawscall('Kernel.NewROScalar', $_[0]);
}
+ sub newblankrwscalar {
+ rawscall('Kernel.NewRWScalar', rawsget('Kernel.AnyP'));
+ }
+
sub newrwscalar {
rawscall('Kernel.NewRWScalar', $_[0]);
}
View
@@ -105,42 +105,33 @@ use CgOp;
has slot => (isa => 'Str', is => 'ro', required => 1);
has list => (isa => 'Bool', is => 'ro', default => 0);
has hash => (isa => 'Bool', is => 'ro', default => 0);
- has shared => (isa => 'Bool', is => 'ro', default => 0);
- has zeroinit => (isa => 'Bool', is => 'ro', default => 0);
- has noenter => (isa => 'Bool', is => 'ro', default => 0);
sub dynamic {
$_[0]->slot =~ /^.?[?*]/;
}
sub used_slots {
- [$_[0]->slot, 'Variable', ($_[1] || $_[0]->shared) && !$_[0]->dynamic];
+ [$_[0]->slot, 'Variable', $_[1] && !$_[0]->dynamic];
}
sub preinit_code {
my ($self, $body) = @_;
- if ($self->zeroinit) {
- CgOp::proto_var($self->slot, CgOp::newrwscalar(CgOp::null('IP6')));
- } elsif ($self->list) {
+ if ($self->list) {
CgOp::proto_var($self->slot, CgOp::newblanklist);
} elsif ($self->hash) {
CgOp::proto_var($self->slot, CgOp::newblankhash);
} else {
- CgOp::proto_var($self->slot,
- CgOp::newrwscalar(CgOp::fetch(CgOp::scopedlex('Any'))));
+ CgOp::proto_var($self->slot, CgOp::newblankrwscalar);
}
}
sub enter_code {
my ($self, $body) = @_;
- return CgOp::noop if $self->noenter;
-
- (($body->mainline || $self->shared) && !$self->dynamic) ? CgOp::noop :
+ ($body->mainline && !$self->dynamic) ? CgOp::noop :
CgOp::scopedlex($self->slot, $self->list ? CgOp::newblanklist :
- $self->hash ? CgOp::newblankhash :
- CgOp::newrwscalar(CgOp::fetch(CgOp::scopedlex('Any'))));
+ $self->hash ? CgOp::newblankhash : CgOp::newblankrwscalar);
}
__PACKAGE__->meta->make_immutable;
View
@@ -2156,10 +2156,10 @@ sub comp_unit { my ($cl, $M) = @_;
name => 'install',
signature => Sig->new(params => [
Sig::Parameter->new(name => '!mainline',
- slot => '!mainline', zeroinit => 1)]),
+ slot => '!mainline')]),
do => Op::CallSub->new(node($M),
- invocant => Op::CgOp->new(op => CgOp::newscalar(
- CgOp::rawsget($::SETTINGNAME . ".Installer"))),
+ invocant => Op::CgOp->new(optree => [ 'newscalar',
+ [ 'rawsget', $::SETTINGNAME . ".Installer" ] ]),
positionals => [Op::SubDef->new(
var => $cl->gensym, body => $body)]));
}
View
@@ -39,9 +39,11 @@ use CgOp;
use Moose;
extends 'Op';
- has optree => (is => 'ro', required => 1);
+ has op => (is => 'ro');
+ has optree => (is => 'ro');
sub zyg {
+ return () unless $_[0]->optree;
our $rec; local $rec = sub {
my ($node) = @_;
blessed($node) ? ($node) :
@@ -52,6 +54,7 @@ use CgOp;
sub code {
my ($self, $body) = @_;
+ return $self->op if $self->op;
our $rec; local $rec = sub {
my ($node) = @_;
return $node if !ref($node);
View
@@ -17,14 +17,13 @@ use 5.010;
has name => (is => 'ro', isa => 'Str', required => 1);
has list => (is => 'ro', isa => 'Bool', default => 0);
has hash => (is => 'ro', isa => 'Bool', default => 0);
- has zeroinit => (is => 'ro', isa => 'Bool', default => 0);
has type => (is => 'ro', isa => 'Str', default => 'Any');
sub local_decls {
my ($self) = @_;
my @r;
push @r, Decl::SimpleVar->new(slot => $self->slot, hash => $self->hash,
- list => $self->list, zeroinit => $self->zeroinit)
+ list => $self->list)
if defined $self->slot;
push @r, $self->default->lift_decls if $self->default;
@r;

0 comments on commit f6ca7b8

Please sign in to comment.