Add purity to LocalInfo and initialize in binder
The `LocalInfo` struct now includes a `purity` field to track the purity of local variables and function arguments. This is initialized to `Purity::Impure` for local variables and arguments within functions and when registering native functions. Additionally, the `Environment` struct is updated to include `root_scopes` and `root_slot_count` to support parallel mode compilation by populating the root scope with initial function and native function information.
This commit is contained in:
@@ -3,7 +3,7 @@ use crate::ast::compiler::bound_nodes::{
|
||||
};
|
||||
use crate::ast::diagnostics::Diagnostics;
|
||||
use crate::ast::nodes::{Node, Symbol, UntypedKind};
|
||||
use crate::ast::types::{Identity, StaticType};
|
||||
use crate::ast::types::{Identity, StaticType, Purity};
|
||||
use std::cell::RefCell;
|
||||
use std::collections::HashMap;
|
||||
use std::rc::Rc;
|
||||
@@ -13,6 +13,7 @@ pub struct LocalInfo {
|
||||
pub addr: Address,
|
||||
pub identity: Identity,
|
||||
pub _ty: StaticType,
|
||||
pub purity: Purity,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
@@ -69,6 +70,7 @@ impl FunctionCompiler {
|
||||
addr: Address::Local(slot),
|
||||
identity,
|
||||
_ty: StaticType::Any,
|
||||
purity: Purity::Impure,
|
||||
},
|
||||
);
|
||||
self.slot_count += 1;
|
||||
@@ -191,6 +193,7 @@ impl Binder {
|
||||
addr,
|
||||
identity,
|
||||
_ty: StaticType::Any,
|
||||
purity: Purity::Impure,
|
||||
},
|
||||
);
|
||||
return Some(addr);
|
||||
|
||||
Reference in New Issue
Block a user