Skip to content

Commit

Permalink
Some minor changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
jens-siebert committed Feb 5, 2024
1 parent 8dbe59f commit 26732d7
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions rlox-lib/src/base/expr_result.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pub enum ExprResult {
Boolean(bool),
Function(LoxFunction),
Class(LoxClass),
Instance(Rc<LoxInstance>),
Instance(LoxInstance),
#[default]
None,
}
Expand All @@ -43,7 +43,7 @@ impl ExprResult {
}

pub fn instance(instance: LoxInstance) -> Self {
ExprResult::Instance(Rc::new(instance))
ExprResult::Instance(instance)
}

pub fn none() -> Self {
Expand Down Expand Up @@ -166,14 +166,14 @@ impl Callable for LoxClass {
#[derive(Clone, Debug, PartialEq)]
pub struct LoxInstance {
class: LoxClass,
fields: RefCell<HashMap<String, ExprResult>>,
fields: Rc<RefCell<HashMap<String, ExprResult>>>,
}

impl LoxInstance {
pub fn new(class: LoxClass) -> Self {
Self {
class,
fields: RefCell::new(HashMap::new()),
fields: Rc::new(RefCell::new(HashMap::new())),
}
}

Expand Down

0 comments on commit 26732d7

Please sign in to comment.