Interpreter - Basic, mostly empty class data structure

This commit is contained in:
Emmanuel BENOîT 2023-01-07 14:14:45 +01:00
parent afb465d6df
commit 6fa335b2f6

View file

@ -0,0 +1,18 @@
/// A Lox class.
#[derive(Debug, Clone)]
pub struct Class {
name: String,
}
impl Class {
/// Create a new class, specifying its name.
pub fn new(name: String) -> Self {
Self { name }
}
}
impl ToString for Class {
fn to_string(&self) -> String {
self.name.clone()
}
}