mirror of
https://github.com/MorizzG/rlox.git
synced 2025-12-06 04:12:42 +00:00
replaced Box<str> with SmolStr
This commit is contained in:
parent
fb88595b6c
commit
da6a820638
21 changed files with 137 additions and 85 deletions
|
|
@ -3,6 +3,7 @@ use std::rc::Rc;
|
|||
|
||||
use rlox2_frontend::parser::{Expr, Stmt};
|
||||
use rustc_hash::FxHashMap;
|
||||
use smol_str::SmolStr;
|
||||
|
||||
use crate::{LoxFunction, LoxReference, Value};
|
||||
|
||||
|
|
@ -10,7 +11,7 @@ use crate::{LoxFunction, LoxReference, Value};
|
|||
pub struct LoxClass {
|
||||
superclass: Option<Rc<LoxClass>>,
|
||||
|
||||
name: Box<str>,
|
||||
name: SmolStr,
|
||||
|
||||
methods: FxHashMap<String, Value>,
|
||||
}
|
||||
|
|
@ -18,7 +19,7 @@ pub struct LoxClass {
|
|||
/// Representation of a class in Lox. Always behind an Rc to ensure uniqueness. Should never be handled raw.
|
||||
impl LoxClass {
|
||||
pub fn new(
|
||||
name: impl Into<Box<str>>,
|
||||
name: impl Into<SmolStr>,
|
||||
methods: FxHashMap<String, Value>,
|
||||
superclass: Option<Rc<LoxClass>>,
|
||||
) -> Rc<Self> {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue