Skip to content

Commit

Permalink
() is now Nil, a constant
Browse files Browse the repository at this point in the history
  • Loading branch information
sorear committed Oct 15, 2010
1 parent 0644834 commit 6d9e43e
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 15 deletions.
4 changes: 1 addition & 3 deletions lib/SAFE.setting
Expand Up @@ -352,9 +352,7 @@ my class Parcel is Cool {
}
}
# Maybe this should be a constant, but constants are currently forced to
# scalar-nature (TODO)
sub Nil() { Q:CgOp { (newrwlistvar (@ (box Parcel (fvarlist_new)))) } }
constant Nil = Q:CgOp { (newrwlistvar (@ (box Parcel (fvarlist_new)))) };
my class List is Cool {
has @!items;
Expand Down
2 changes: 1 addition & 1 deletion src/CgOp.pm
Expand Up @@ -104,7 +104,7 @@ use warnings;
sub noop { prog() }

sub rnull {
prog($_[0], null('var'));
prog($_[0], scopedlex('Nil'));
}

sub getattr {
Expand Down
18 changes: 8 additions & 10 deletions src/Op.pm
Expand Up @@ -89,8 +89,7 @@ use CgOp;
sub code {
my ($self, $body) = @_;
my @ch = map { $_->cgop($body) } @{ $self->children };
# XXX should be Nil or something
my $end = @ch ? pop(@ch) : CgOp::scopedlex('Any');
my $end = @ch ? pop(@ch) : CgOp::scopedlex('Nil');

CgOp::prog((map { CgOp::sink($_) } @ch), $end);
}
Expand Down Expand Up @@ -461,11 +460,10 @@ use CgOp;
CgOp::unbox('bool',
CgOp::fetch(
CgOp::methodcall($self->check->cgop($body), "Bool"))),
# XXX use Nil
($self->true ? $self->true->cgop($body) :
CgOp::null('var')),
CgOp::scopedlex('Nil')),
($self->false ? $self->false->cgop($body) :
CgOp::null('var')));
CgOp::scopedlex('Nil')));
}

__PACKAGE__->meta->make_immutable;
Expand Down Expand Up @@ -500,7 +498,7 @@ use CgOp;
CgOp::ehspan(2, undef, 0, "redo$id", "next$id", "last$id"),
CgOp::ehspan(3, undef, 0, "redo$id", "next$id", "redo$id"))),
CgOp::label("last$id"),
CgOp::null('var'));
CgOp::scopedlex('Nil'));
}

__PACKAGE__->meta->make_immutable;
Expand Down Expand Up @@ -555,7 +553,7 @@ use CgOp;
CgOp::unbox('bool',
CgOp::fetch(
CgOp::methodcall(CgOp::scopedlex($self->condvar), "Bool"))),
CgOp::scopedlex('Any'), #Nil
CgOp::scopedlex('Nil'),
CgOp::prog(
CgOp::assign(CgOp::scopedlex($self->condvar),
CgOp::box('Bool', CgOp::bool(1))),
Expand Down Expand Up @@ -706,7 +704,7 @@ use CgOp;

sub code {
my ($self, $body) = @_;
CgOp::null('var');
CgOp::scopedlex('Nil');
}

__PACKAGE__->meta->make_immutable;
Expand All @@ -723,7 +721,7 @@ use CgOp;

sub code {
my ($self, $body) = @_;
CgOp::null('var');
CgOp::scopedlex('Nil');
}

__PACKAGE__->meta->make_immutable;
Expand Down Expand Up @@ -927,7 +925,7 @@ use CgOp;

has unit => (isa => 'Str', is => 'ro', required => 1);

sub code { CgOp::null('var') }
sub code { CgOp::scopedlex('Nil') }

__PACKAGE__->meta->make_immutable;
no Moose;
Expand Down
2 changes: 1 addition & 1 deletion v6/TODO
@@ -1,6 +1,5 @@
~
<?{ }>
() being Nil
circumfix:<[ ]>
Cursor.add_categorical
Cursor.alpha
Expand Down Expand Up @@ -40,6 +39,7 @@ token { :my $var = expr; $var }
token { $param-role-var }

DONE:
() being Nil
Bool.Numeric
&chars
defined($thing)
Expand Down

0 comments on commit 6d9e43e

Please sign in to comment.