add #include

This commit is contained in:
Mark
2023-11-15 17:55:07 +01:00
parent e851559016
commit 39951a59e9
16 changed files with 283 additions and 60 deletions

View File

@@ -23,6 +23,7 @@ pub trait Local: Default + Debug {
fn get_var_mut(&mut self, id: &Self::VariableIdentifier) -> Option<&mut Self::VariableData>;
// fn add_type(&mut self, id: Self::TypesIdentifier, new_type: Self::TypesType);
// fn get_type(&self, id: Self::TypesIdentifier) -> Option<&Self::TypesType>;
fn duplicate(&self) -> Self;
}
impl<L: Local> Info<L> {
@@ -47,6 +48,11 @@ impl<L: Local> Local for Info<L> {
fn get_var_mut(&mut self, id: &Self::VariableIdentifier) -> Option<&mut Self::VariableData> {
self.scopes.iter_mut().find_map(|l| l.get_var_mut(id))
}
fn duplicate(&self) -> Self {
Self {
scopes: self.scopes.iter().map(|v| v.duplicate()).collect(),
}
}
}
impl<L: Local> Default for Info<L> {