it runs! gets the wrong answer, but runs!
This commit is contained in:
@@ -13,6 +13,7 @@ use std::str::FromStr;
|
||||
/// that we're not going to be able to work through. As with most
|
||||
/// of these errors, we recommend converting this to a [`Diagnostic`]
|
||||
/// and using [`codespan_reporting`] to present them to the user.
|
||||
#[derive(Debug)]
|
||||
pub enum Error {
|
||||
UnboundVariable(Location, String),
|
||||
UnknownType(Location, String),
|
||||
@@ -83,6 +84,9 @@ impl Program {
|
||||
let mut warnings = vec![];
|
||||
|
||||
for stmt in self.items.iter() {
|
||||
if let TopLevel::Function(Some(name), _, _) = stmt {
|
||||
bound_variables.insert(name.to_string(), name.location.clone());
|
||||
}
|
||||
let (mut new_errors, mut new_warnings) = stmt.validate_with_bindings(bound_variables);
|
||||
errors.append(&mut new_errors);
|
||||
warnings.append(&mut new_warnings);
|
||||
|
||||
Reference in New Issue
Block a user