From f834d84365672d134a364994de5927a9255afaa9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emmanuel=20Beno=C3=AEt?= Date: Sat, 7 Jan 2023 14:15:04 +0100 Subject: [PATCH] Interpreter - Class values --- src/interpreter/value.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/interpreter/value.rs b/src/interpreter/value.rs index f27198b..47f28f5 100644 --- a/src/interpreter/value.rs +++ b/src/interpreter/value.rs @@ -1,6 +1,6 @@ use std::{cell::RefCell, fmt::Display, rc::Rc}; -use super::Callable; +use super::{Callable, class::Class}; /// A value being handled by the interpreter. #[derive(Debug, Clone)] @@ -10,6 +10,7 @@ pub enum Value { String(String), Number(f64), Callable(Rc>), + Class(Class), } impl PartialEq for Value { @@ -32,6 +33,7 @@ impl Display for Value { Value::String(s) => s.fmt(f), Value::Number(n) => n.fmt(f), Value::Callable(c) => f.write_str(&c.borrow().to_string()), + Value::Class(c) => f.write_str(&c.to_string()), } } }