fix bug where #include included files would be able to access local variables and custom types. now, only globals are shared.

This commit is contained in:
Mark 2023-11-24 12:51:54 +01:00
parent 4144d6cf71
commit 12af47d18a
2 changed files with 2 additions and 2 deletions

View File

@ -52,7 +52,7 @@ impl<L: Local> Local for Info<L> {
}
fn duplicate(&self) -> Self {
Self {
scopes: self.scopes.iter().map(|v| v.duplicate()).collect(),
scopes: vec![self.scopes[0].duplicate()],
global: self.global.clone(),
}
}

View File

@ -28,7 +28,7 @@ impl MersStatement for IncludeMers {
comp: CompInfo,
) -> Result<Box<dyn program::run::MersStatement>, CheckError> {
let compiled: Arc<Box<dyn crate::program::run::MersStatement>> =
match self.include.compile(info, comp) {
match self.include.compile(&mut info.duplicate(), comp) {
Ok(v) => Arc::new(v),
Err(e) => {
return Err(CheckError::new()