Make LocalInfo and CompilerScope fields public

This commit is contained in:
Michael Schimmel
2026-03-12 12:57:04 +01:00
parent be2bef373f
commit bc13ce7abf
+12 -8
View File
@@ -9,22 +9,22 @@ use std::collections::HashMap;
use std::rc::Rc; use std::rc::Rc;
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
struct LocalInfo { pub struct LocalInfo {
addr: Address, pub addr: Address,
identity: Identity, pub identity: Identity,
// Note: Binder doesn't strictly need the type anymore, // Note: Binder doesn't strictly need the type anymore,
// but it might be useful for built-ins during resolution. // but it might be useful for built-ins during resolution.
// For now we keep it as Any or Unknown. // For now we keep it as Any or Unknown.
_ty: StaticType, pub _ty: StaticType,
} }
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
struct CompilerScope { pub struct CompilerScope {
locals: HashMap<Symbol, LocalInfo>, pub locals: HashMap<Symbol, LocalInfo>,
} }
impl CompilerScope { impl CompilerScope {
fn new() -> Self { pub fn new() -> Self {
Self { Self {
locals: HashMap::new(), locals: HashMap::new(),
} }
@@ -41,7 +41,11 @@ struct FunctionCompiler {
} }
impl FunctionCompiler { impl FunctionCompiler {
fn new(fixed_scope_idx: i32, identity: Identity, is_root: bool) -> Self { fn new(
fixed_scope_idx: i32,
identity: Identity,
is_root: bool,
) -> Self {
Self { Self {
identity, identity,
scopes: vec![CompilerScope::new()], scopes: vec![CompilerScope::new()],