Refactor scope handling and immutability
Introduces `fixed_scope_idx` to `Binder` and `Environment` to track immutable scopes. This allows enforcing that definitions (`def`) cannot occur in scopes that are considered fixed or immutable, such as the global scope or the initial bootstrap scope. The `FunctionCompiler` is updated to use `fixed_scope_idx` and `is_root` to determine scope immutability.
This commit is contained in:
@@ -778,7 +778,7 @@ mod tests {
|
||||
let globals = Rc::new(RefCell::new(global_names));
|
||||
|
||||
let mut diag = crate::ast::diagnostics::Diagnostics::new();
|
||||
let result = Binder::bind_root(globals, &expanded, &mut diag);
|
||||
let result = Binder::bind_root(globals, 0, &expanded, &mut diag);
|
||||
assert!(
|
||||
result.is_ok(),
|
||||
"Should find global '*' Error: {:?}",
|
||||
@@ -803,7 +803,7 @@ mod tests {
|
||||
|
||||
let globals = Rc::new(RefCell::new(HashMap::new()));
|
||||
let mut diag = crate::ast::diagnostics::Diagnostics::new();
|
||||
let result = Binder::bind_root(globals, &expanded, &mut diag);
|
||||
let result = Binder::bind_root(globals, 0, &expanded, &mut diag);
|
||||
assert!(result.is_ok(), "Hygiene failed: {:?}", result.err());
|
||||
}
|
||||
|
||||
@@ -824,7 +824,7 @@ mod tests {
|
||||
|
||||
let globals = Rc::new(RefCell::new(HashMap::new()));
|
||||
let mut diag = crate::ast::diagnostics::Diagnostics::new();
|
||||
let result = Binder::bind_root(globals, &expanded, &mut diag);
|
||||
let result = Binder::bind_root(globals, 0, &expanded, &mut diag);
|
||||
assert!(
|
||||
result.is_ok(),
|
||||
"Explicit Hygiene with Backticks failed: {:?}",
|
||||
|
||||
Reference in New Issue
Block a user