MIR: lexical scoping + builder vars modules

This commit is contained in:
nyash-codex
2025-12-13 01:30:04 +09:00
parent 5c75506dcc
commit 1fae4f1648
16 changed files with 388 additions and 29 deletions

View File

@ -170,6 +170,8 @@ impl super::MirBuilder {
// Scope hint for bare block (Program)
let scope_id = self.current_block.map(|bb| bb.as_u32()).unwrap_or(0);
self.hint_scope_enter(scope_id);
let _lex_scope = super::vars::lexical_scope::LexicalScopeGuard::new(self);
let mut last_value = None;
let total = statements.len();
eprintln!("[DEBUG/build_block] Processing {} statements", total);
@ -336,7 +338,7 @@ impl super::MirBuilder {
var_name, var_id
);
}
self.variable_map.insert(var_name.clone(), var_id);
self.declare_local_in_current_scope(var_name, var_id)?;
// SlotRegistry にもローカル変数スロットを登録しておくよ(観測専用)
if let Some(reg) = self.current_slot_registry.as_mut() {
let ty = self.value_types.get(&var_id).cloned();