1
0

Fix bug with loop contexts

This commit is contained in:
Jeff 2024-02-12 14:19:07 -05:00
parent d243c030e8
commit 924b388f2c
2 changed files with 4 additions and 6 deletions

View File

@ -67,12 +67,10 @@ impl AbstractTree for Block {
}
fn validate(&self, _source: &str, _context: &Context) -> Result<(), ValidationError> {
self.context.inherit_from(_context)?;
for statement in &self.statements {
if let Statement::Return(inner_statement) = statement {
return inner_statement.validate(_source, &self.context);
} else {
statement.validate(_source, &self.context)?;
}
statement.validate(_source, &self.context)?;
}
Ok(())

View File

@ -72,7 +72,7 @@ impl AbstractTree for For {
};
let key = self.item_id.inner().clone();
context.set_type(key, item_type)?;
self.block.context().set_type(key, item_type)?;
self.block.validate(_source, context)
}