Remove mut on compilation unit params in name analysis.

This commit is contained in:
Jesse Brault 2025-10-09 17:16:18 -05:00
parent 2b5be6ca49
commit b47dea9136
3 changed files with 5 additions and 5 deletions

View File

@ -31,7 +31,7 @@ pub fn name_analysis(paths: &Vec<PathBuf>) -> Result<(), Box<dyn std::error::Err
let mut symbol_table = SymbolTable::new();
add_std_core_symbols(&mut symbol_table).expect("Failed to add std::core symbols.");
let diagnostics = analyze_names(compilation_units.as_mut_slice(), &files, &mut symbol_table);
let diagnostics = analyze_names(&compilation_units, &files, &mut symbol_table);
if diagnostics.is_empty() {
println!("Name analysis complete.");
println!("{}", symbol_table);

View File

@ -334,7 +334,7 @@ fn gather_node<'a>(
}
pub fn gather_compilation_unit<'a>(
compilation_unit: &'a mut CompilationUnit,
compilation_unit: &'a CompilationUnit,
file_name: &str,
symbol_table: &mut SymbolTable,
scope_ids: &mut HashMap<&'a VariableUse, usize>,

View File

@ -34,7 +34,7 @@ pub mod symbol;
pub mod symbol_table;
pub fn analyze_names<'a, F: Files<'a, FileId = usize, Name = String>>(
compilation_units: &mut [Box<CompilationUnit>],
compilation_units: &[Box<CompilationUnit>],
files: &'a F,
symbol_table: &mut SymbolTable,
) -> Vec<DmDiagnostic> {
@ -42,7 +42,7 @@ pub fn analyze_names<'a, F: Files<'a, FileId = usize, Name = String>>(
let mut scope_ids: HashMap<&VariableUse, usize> = HashMap::new();
// gather symbols
for compilation_unit in compilation_units.iter_mut() {
for compilation_unit in compilation_units {
let file_name = files.name(compilation_unit.file_id()).unwrap();
gather_compilation_unit(
compilation_unit,
@ -54,7 +54,7 @@ pub fn analyze_names<'a, F: Files<'a, FileId = usize, Name = String>>(
}
// resolve symbols
for compilation_unit in compilation_units.iter_mut() {
for compilation_unit in compilation_units {
// resolve_compilation_unit(compilation_unit, symbol_table, &mut diagnostics);
}