simplify scopes
This commit is contained in:
parent
fa808478ab
commit
291333444f
|
|
@ -32,7 +32,7 @@ impl Debug for Function {
|
|||
|
||||
#[derive(Debug, Clone, Default)]
|
||||
pub struct Scope {
|
||||
pub variables: HashMap<String, Value>,
|
||||
pub variables: HashMap<String, ValueInner>,
|
||||
pub functions: HashMap<String, Function>,
|
||||
}
|
||||
|
||||
|
|
@ -54,7 +54,7 @@ impl Eval for Constant {
|
|||
impl Eval for Location {
|
||||
fn eval(&self, scope: &mut Scope) -> Value {
|
||||
match self {
|
||||
Location::Variable { name } => scope.variables.get(name).cloned().flatten(),
|
||||
Location::Variable { name } => scope.variables.get(name).cloned(),
|
||||
Location::Field { table, index } => {
|
||||
let table = table.eval(scope);
|
||||
let Some(ValueInner::Table(table)) = table else {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user