[fine] lets can be local or global
This commit is contained in:
parent
fa53841af9
commit
f8f5c9bfac
2 changed files with 32 additions and 8 deletions
|
|
@ -424,12 +424,19 @@ impl<'a> Semantics<'a> {
|
|||
None => Type::Error,
|
||||
};
|
||||
|
||||
let base_index = match parent.location {
|
||||
Location::Local => parent.base_index + parent.declarations.len(),
|
||||
_ => 0,
|
||||
let (location, base_index) = match parent.location {
|
||||
Location::Local => (
|
||||
Location::Local,
|
||||
parent.base_index + parent.declarations.len(),
|
||||
),
|
||||
Location::Module => (
|
||||
Location::Module,
|
||||
parent.base_index + parent.declarations.len(),
|
||||
),
|
||||
Location::Argument => (Location::Local, 0),
|
||||
};
|
||||
|
||||
let mut environment = Environment::new(Some(parent), Location::Local, base_index);
|
||||
let mut environment = Environment::new(Some(parent), location, base_index);
|
||||
environment.insert(name, declaration_type);
|
||||
|
||||
EnvironmentRef::new(environment)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue