Fix bug with loop contexts
This commit is contained in:
parent
d243c030e8
commit
924b388f2c
@ -67,12 +67,10 @@ impl AbstractTree for Block {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn validate(&self, _source: &str, _context: &Context) -> Result<(), ValidationError> {
|
fn validate(&self, _source: &str, _context: &Context) -> Result<(), ValidationError> {
|
||||||
|
self.context.inherit_from(_context)?;
|
||||||
|
|
||||||
for statement in &self.statements {
|
for statement in &self.statements {
|
||||||
if let Statement::Return(inner_statement) = statement {
|
statement.validate(_source, &self.context)?;
|
||||||
return inner_statement.validate(_source, &self.context);
|
|
||||||
} else {
|
|
||||||
statement.validate(_source, &self.context)?;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
@ -72,7 +72,7 @@ impl AbstractTree for For {
|
|||||||
};
|
};
|
||||||
let key = self.item_id.inner().clone();
|
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)
|
self.block.validate(_source, context)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user