mirror of
https://github.com/MorizzG/rlox.git
synced 2025-12-06 04:12:42 +00:00
added type Attrs = FxHashMap<SmolStr, Value>
This commit is contained in:
parent
812cf0d2d0
commit
943528a0db
4 changed files with 14 additions and 9 deletions
|
|
@ -1,12 +1,12 @@
|
|||
use std::rc::Rc;
|
||||
|
||||
use rlox2_frontend::parser::{BinaryOp, Expr, Literal, LogicalOp, Stmt, UnaryOp};
|
||||
use rustc_hash::FxHashMap;
|
||||
|
||||
use super::environment::Environment;
|
||||
use super::{LoxFunction, Runtime, Value};
|
||||
use crate::error::RuntimeError;
|
||||
use crate::function::LoxExternFunction;
|
||||
use crate::value::Attrs;
|
||||
use crate::{LoxClass, LoxReference};
|
||||
|
||||
pub type EvalResult<T> = Result<T, RuntimeError>;
|
||||
|
|
@ -206,7 +206,7 @@ impl Eval for Expr {
|
|||
None => None,
|
||||
};
|
||||
|
||||
let mut methods: FxHashMap<String, Value> = FxHashMap::default();
|
||||
let mut methods = Attrs::default();
|
||||
|
||||
// this is the scope "this" will get injected in
|
||||
env.enter_scope()?;
|
||||
|
|
@ -215,7 +215,7 @@ impl Eval for Expr {
|
|||
let method = method_expr.eval(env)?;
|
||||
|
||||
if let Value::Function(ref fun) = method {
|
||||
let name = fun.name().to_owned();
|
||||
let name = fun.name().into();
|
||||
methods.insert(name, method);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue