true local contexts

This commit is contained in:
2022-03-11 11:11:03 +01:00
parent cb4fda6631
commit d2456ef681
5 changed files with 79 additions and 49 deletions

View File

@@ -2,13 +2,13 @@ use super::value::Value;
use std::collections::HashMap;
#[derive(Clone)]
pub struct Context {
pub struct Context<'par> {
dict: HashMap<String, Value>,
parent: Option<Box<Context>>,
parent: Option<&'par Context<'par>>,
}
impl Context {
pub fn new(parent: Option<Box<Context>>) -> Context {
impl<'par> Context<'par> {
pub fn new(parent: Option<&'par Context<'par>>) -> Context<'par> {
Context {
dict: HashMap::new(),
parent,