checkpoint
This commit is contained in:
@@ -180,7 +180,10 @@ impl Statement {
|
||||
}
|
||||
|
||||
impl Expression {
|
||||
fn validate(&self, variable_map: &ScopedMap<String, Location>) -> (Vec<Error>, Vec<Warning>) {
|
||||
fn validate(
|
||||
&self,
|
||||
variable_map: &mut ScopedMap<String, Location>,
|
||||
) -> (Vec<Error>, Vec<Warning>) {
|
||||
match self {
|
||||
Expression::Value(_, _) => (vec![], vec![]),
|
||||
Expression::Reference(_, var) if variable_map.contains_key(var) => (vec![], vec![]),
|
||||
@@ -207,6 +210,19 @@ impl Expression {
|
||||
warnings.append(&mut warn);
|
||||
}
|
||||
|
||||
(errors, warnings)
|
||||
}
|
||||
Expression::Block(_, stmts) => {
|
||||
let mut errors = vec![];
|
||||
let mut warnings = vec![];
|
||||
|
||||
for stmt in stmts.iter() {
|
||||
let (mut local_errors, mut local_warnings) = stmt.validate(variable_map);
|
||||
|
||||
errors.append(&mut local_errors);
|
||||
warnings.append(&mut local_warnings);
|
||||
}
|
||||
|
||||
(errors, warnings)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user