Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Use a native Boolean for List $!flat
  • Loading branch information
sorear committed Sep 13, 2010
1 parent 72a824b commit 0c06bec
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
8 changes: 4 additions & 4 deletions lib/Cursor.cs
Expand Up @@ -97,7 +97,7 @@ public sealed class RxFrame {
DynObject lst = new DynObject(ListMO);
lst.slots[0 /*items*/] = new VarDeque();
lst.slots[1 /*rest*/ ] = new VarDeque();
lst.slots[2 /*flat*/ ] = Kernel.NewROScalar(Kernel.AnyP);
lst.slots[2 /*flat*/ ] = false;
th.caller.resultSlot = Kernel.NewRWListVar(lst);
}

Expand Down Expand Up @@ -258,7 +258,7 @@ public sealed class RxFrame {
DynObject lst = new DynObject(ListMO);
lst.slots[0 /*items*/] = ks;
lst.slots[1 /*rest*/ ] = iss;
lst.slots[2 /*flat*/ ] = Kernel.NewROScalar(Kernel.AnyP);
lst.slots[2 /*flat*/ ] = false;
th.caller.resultSlot = Kernel.NewRWListVar(lst);
}
return th.caller;
Expand Down Expand Up @@ -346,7 +346,7 @@ public Cursor(IP6 proto, string text)
DynObject l = new DynObject(RxFrame.ListMO);
l.slots[0 /*items*/] = caps;
l.slots[1 /*rest*/ ] = new VarDeque();
l.slots[2 /*flat*/ ] = Kernel.NewROScalar(Kernel.AnyP);
l.slots[2 /*flat*/ ] = false;
return Kernel.NewRWListVar(l);
} else {
return caps.Count() != 0 ? caps[0] :
Expand All @@ -363,7 +363,7 @@ public Cursor(IP6 proto, string text)
DynObject lst = new DynObject(RxFrame.ListMO);
lst.slots[0 /*items*/] = ks;
lst.slots[1 /*rest*/ ] = new VarDeque();
lst.slots[2 /*flat*/ ] = Kernel.NewROScalar(Kernel.AnyP);
lst.slots[2 /*flat*/ ] = false;

if (p != 0 && p != l && CC.Word.Accepts(backing[p]) &&
CC.Word.Accepts(backing[p-1])) {
Expand Down
7 changes: 4 additions & 3 deletions lib/SAFE.setting
Expand Up @@ -454,7 +454,8 @@ my class List is Cool {
has @!rest;
has $!flat;
method flat() {
unitem($!flat ?? self !! self.SETUP(True, (&infix:<,>(self.iterator))));
unitem(Q:CgOp { (box Bool (getslot (s flat) (@ {self}))) }
?? self !! self.SETUP(True, (&infix:<,>(self.iterator))));
}
method list() { unitem(self) }

Expand All @@ -472,7 +473,7 @@ my class List is Cool {
method SETUP($flat, $parcel) { Q:CgOp {
(letn new (rawnew DynObject (rawcall (@ {self}) GetMO))
(rawcall (l new) SetSlot (s flat) {$flat})
(rawcall (l new) SetSlot (s flat) (unbox Boolean (@ {$flat.Bool})))
(rawcall (l new) SetSlot (s rest) (rawnew VarDeque
(unbox 'Variable[]' (@ {$parcel}))))
(rawcall (l new) SetSlot (s items) (rawnew VarDeque))
Expand Down Expand Up @@ -523,7 +524,7 @@ my class List is Cool {
(letn nr (cast Int32 (unbox Double (@ {$nr})))
items (cast VarDeque (getslot (s items) (@ {self})))
rest (cast VarDeque (getslot (s rest) (@ {self})))
flat (unbox Boolean (@ {$!flat.Bool}))
flat (cast Boolean (getslot (s flat) (@ {self})))
v (null Variable)
ItMo (rawcall (@ {Iterator}) GetMO)
(whileloop 0 0
Expand Down
2 changes: 1 addition & 1 deletion src/Sig.pm
Expand Up @@ -36,7 +36,7 @@ use 5.010;
my $do = shift;
CgOp::prog(
CgOp::rawcall($do, 'SetSlot', CgOp::clr_string('flat'),
CgOp::box('Bool', CgOp::bool(1))),
CgOp::bool(1)),
CgOp::rawcall($do, 'SetSlot', CgOp::clr_string('items'),
CgOp::rawnew('VarDeque')),
CgOp::rawcall($do, 'SetSlot', CgOp::clr_string('rest'),
Expand Down

0 comments on commit 0c06bec

Please sign in to comment.