Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
todesking committed Apr 18, 2024
1 parent d454faa commit 5f00231
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 22 deletions.
18 changes: 5 additions & 13 deletions src/evaluator.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
use gc::Gc;
use gc::GcCell;
use gc::Trace;

use crate::ast::ArrayItem;
use crate::ast::Ident;
use crate::ast::ObjItem;

use crate::object_value;
use crate::value::AtomValue;
use crate::value::LocalEnv;
Expand All @@ -17,10 +12,10 @@ use crate::EvalError;
use crate::Expr;
use crate::Program;
use crate::Value;

use std::borrow::BorrowMut;
use gc::Gc;
use gc::GcCell;
use gc::Trace;
use std::collections::HashMap;

use std::fmt::Display;
use std::marker::PhantomData;
use std::rc::Rc;
Expand Down Expand Up @@ -323,11 +318,8 @@ impl<L: ModuleLoader> RuntimeContext<L> {
.pub_object()
.use_object(|o| {
for (name, value) in o.iter() {
match name {
ObjectKey::Str(name) => {
m.bind(&**name, value.clone(), false, false)?;
}
_ => {}
if let ObjectKey::Str(name) = name {
m.bind(&**name, value.clone(), false, false)?;
}
}
Ok(())
Expand Down
15 changes: 6 additions & 9 deletions src/value.rs
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
use std::{
borrow::Borrow,
collections::HashMap,
fmt::{Display, Write},
rc::Rc,
};

use gc::{Finalize, Gc, GcCell, Trace};

use crate::{
ast::Ident,
evaluator::{EvalResult, Module},
EvalError, Expr,
};
use gc::{Finalize, Gc, GcCell, Trace};
use std::{
collections::HashMap,
fmt::{Display, Write},
rc::Rc,
};

#[derive(Debug, PartialEq, Eq, Clone, Finalize)]
pub enum Value {
Expand Down

0 comments on commit 5f00231

Please sign in to comment.