Skip to content

Commit

Permalink
Add WHENCE-based autoviv to Array.
Browse files Browse the repository at this point in the history
  • Loading branch information
pmichaud committed Jul 6, 2010
1 parent 06f2d7c commit f07a656
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions src/core/Array.pm
@@ -1,5 +1,8 @@
augment class Array {
method at_pos($pos) {
my $z = Any!butWHENCE(
{ pir::set__vQiP(self!fill($pos+1), $pos, $z) }
);
Q:PIR {
.local pmc self, items
.local int pos
Expand All @@ -8,15 +11,9 @@ augment class Array {
pos = $P0
$I0 = pos + 1
items = self.'!fill'($I0)
%r = items[pos]
%r = items[pos]
unless null %r goto done
%r = new ['Proxy']
setattribute %r, '$!base', items
$P0 = box pos
setattribute %r, '$!key', $P0
$P0 = get_hll_global ['Bool'], 'True'
setprop %r, 'scalar', $P0
setprop %r, 'rw', $P0
%r = find_lex '$z'
done:
}
}
Expand Down

0 comments on commit f07a656

Please sign in to comment.