BROKEN WIP: GARBAGE COLLECTION AND HEAP MANAGEMENT
Some checks failed
per-push tests / build (push) Failing after 4m38s
per-push tests / test-frontend (push) Has been skipped
per-push tests / timed-decomposer-parse (push) Has been skipped
per-push tests / test-utility (push) Has been skipped
per-push tests / test-backend (push) Has been skipped
Some checks failed
per-push tests / build (push) Failing after 4m38s
per-push tests / test-frontend (push) Has been skipped
per-push tests / timed-decomposer-parse (push) Has been skipped
per-push tests / test-utility (push) Has been skipped
per-push tests / test-backend (push) Has been skipped
Signed-off-by: Ava Affine <ava@sunnypup.io>
This commit is contained in:
parent
8d2d0ebf0c
commit
1359ebdded
6 changed files with 190 additions and 205 deletions
|
|
@ -5,4 +5,4 @@ edition = "2024"
|
|||
|
||||
[dependencies]
|
||||
organelle = { path = "../organelle" }
|
||||
|
||||
hyphae = { path = "../hyphae" }
|
||||
|
|
|
|||
|
|
@ -110,34 +110,6 @@ impl fmt::Debug for Datum {
|
|||
pub struct Ast(pub Rc<Datum>, pub Rc<Datum>);
|
||||
|
||||
impl Ast {
|
||||
pub fn subsl(&self, start: isize, end: isize) -> Ast {
|
||||
if end - start == 1 {
|
||||
return Ast(Rc::from(self[start as usize].clone()), Rc::from(Datum::None))
|
||||
}
|
||||
|
||||
if end == 0 {
|
||||
return Ast(
|
||||
Rc::from((*(self.0)).clone()),
|
||||
Rc::from(Datum::None)
|
||||
)
|
||||
}
|
||||
|
||||
let Datum::List(ref next) = *self.1 else {
|
||||
panic!("index into improper list form")
|
||||
};
|
||||
|
||||
if start <= 0 {
|
||||
Ast(
|
||||
Rc::from((*(self.0)).clone()),
|
||||
Rc::from(Datum::List(
|
||||
Rc::from(next.subsl(start - 1, end - 1))))
|
||||
)
|
||||
|
||||
} else {
|
||||
next.subsl(start - 1, end - 1)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn len(&self) -> usize {
|
||||
let Datum::List(ref next) = *self.1 else {
|
||||
return 1
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue