Fix the parser, make the function name optional.

This commit is contained in:
2023-10-07 11:25:49 +02:00
parent 736d27953f
commit ca26d0ea40
4 changed files with 17 additions and 4 deletions

View File

@@ -117,7 +117,9 @@ impl TopLevel {
match self {
TopLevel::Function(name, arguments, body) => {
bound_variables.new_scope();
bound_variables.insert(name.name.clone(), name.location.clone());
if let Some(name) = name {
bound_variables.insert(name.name.clone(), name.location.clone());
}
for arg in arguments.iter() {
bound_variables.insert(arg.name.clone(), arg.location.clone());
}