From 26732d767862b9aa3338257096f06d0f32acee98 Mon Sep 17 00:00:00 2001 From: Jens Siebert Date: Mon, 5 Feb 2024 15:59:40 +0100 Subject: [PATCH] Some minor changes. --- rlox-lib/src/base/expr_result.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/rlox-lib/src/base/expr_result.rs b/rlox-lib/src/base/expr_result.rs index f0138aa..acc69f0 100644 --- a/rlox-lib/src/base/expr_result.rs +++ b/rlox-lib/src/base/expr_result.rs @@ -16,7 +16,7 @@ pub enum ExprResult { Boolean(bool), Function(LoxFunction), Class(LoxClass), - Instance(Rc), + Instance(LoxInstance), #[default] None, } @@ -43,7 +43,7 @@ impl ExprResult { } pub fn instance(instance: LoxInstance) -> Self { - ExprResult::Instance(Rc::new(instance)) + ExprResult::Instance(instance) } pub fn none() -> Self { @@ -166,14 +166,14 @@ impl Callable for LoxClass { #[derive(Clone, Debug, PartialEq)] pub struct LoxInstance { class: LoxClass, - fields: RefCell>, + fields: Rc>>, } impl LoxInstance { pub fn new(class: LoxClass) -> Self { Self { class, - fields: RefCell::new(HashMap::new()), + fields: Rc::new(RefCell::new(HashMap::new())), } }