Skip to content

Commit

Permalink
Remove last CLR dependencies from setting
Browse files Browse the repository at this point in the history
  • Loading branch information
sorear committed Oct 10, 2010
1 parent c2f02c8 commit 12112fb
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 28 deletions.
36 changes: 14 additions & 22 deletions lib/SAFE.setting
Expand Up @@ -304,9 +304,9 @@ my class List is Cool {
(letn selfo (@ {self})
new (obj_newblank (obj_llhow (l selfo)))
(setslot flat (l new) (getslot flat bool (l selfo)))
(setslot items (l new) (rawnew vvarlist
(setslot items (l new) (vvarlist_clone
(getslot items vvarlist (l selfo))))
(setslot rest (l new) (rawnew vvarlist
(setslot rest (l new) (vvarlist_clone
(getslot rest vvarlist (l selfo))))
(newrwlistvar (l new)))
} }
Expand Down Expand Up @@ -520,31 +520,23 @@ my class Pair is Enum {
}
# }}}
# List utilities {{{
sub postcircumfix:<[ ]> is rawcall {
my $index ::= Q:CgOp { (pos 1) };
(Q:CgOp { (pos 0) }).defined
?? (Q:CgOp { (pos 0) }).at-pos($index)
sub postcircumfix:<[ ]>(\$container, $index) { # TODO: is rwtrans
$container.defined
?? $container.at-pos($index)
!! Any!Any::butWHENCE(sub () is rawcall {
my $ar := Q:CgOp { (getindex (int 0) (getfield pos
(getfield outer (callframe)))) };
$ar.defined && die("Autovivification collision");
$ar = Array.new;
$ar!Array::extend($index, Q:CgOp { (pos 0) });
$container.defined && die("Autovivification collision");
$container = Array.new;
$container!Array::extend($index, Q:CgOp { (pos 0) });
});
}
sub postcircumfix:<{ }> is rawcall {
my $key ::= Q:CgOp { (pos 1) };
(Q:CgOp { (pos 0) }).defined
?? (Q:CgOp { (pos 0) }).at-key($key)
sub postcircumfix:<{ }>(\$container, $key) {
$container.defined
?? $container.at-key($key)
!! Any!Any::butWHENCE(sub () is rawcall {
my $ar := Q:CgOp { (getindex (int 0) (getfield pos
(getfield outer (callframe)))) };
$ar.defined && die("Autovivification collision");
$ar = Hash.new;
$ar!Hash::extend($key, Q:CgOp { (pos 0) });
$container.defined && die("Autovivification collision");
$container = Hash.new;
$container!Hash::extend($key, Q:CgOp { (pos 0) });
});
}
Expand Down
1 change: 1 addition & 0 deletions src/CgOp.pm
Expand Up @@ -178,6 +178,7 @@ use warnings;
sub fvarlist_item { getindex($_[0], $_[1]) }

sub vvarlist_from_fvarlist { rawnew('vvarlist', $_[0]) }
sub vvarlist_clone { rawnew('vvarlist', $_[0]) }
sub vvarlist_new_empty { rawnew('vvarlist') }
sub vvarlist_shift { rawcall($_[0], 'Shift') }
sub vvarlist_pop { rawcall($_[0], 'Pop') }
Expand Down
10 changes: 4 additions & 6 deletions src/Sig.pm
Expand Up @@ -123,9 +123,8 @@ use 5.010;
$self->single_get($body);

if (defined $self->slot) {
return CgOp::scopedlex($self->slot,
CgOp::newboundvar($self->readonly && !$self->rwtrans,
$self->list, $get));
return CgOp::scopedlex($self->slot, $self->rwtrans ? $get :
CgOp::newboundvar($self->readonly, $self->list, $get));
} else {
return CgOp::sink($get);
}
Expand All @@ -139,9 +138,8 @@ use 5.010;
$self->single_get_inline($body, $posr);

if (defined $self->slot) {
return CgOp::scopedlex($self->slot,
CgOp::newboundvar($self->readonly && !$self->rwtrans,
$self->list, $get));
return CgOp::scopedlex($self->slot, $self->rwtrans ? $get :
CgOp::newboundvar($self->readonly, $self->list, $get));
} else {
return CgOp::sink($get);
}
Expand Down

0 comments on commit 12112fb

Please sign in to comment.