Remove mut on compilation unit params in name analysis.
This commit is contained in:
parent
2b5be6ca49
commit
b47dea9136
@ -31,7 +31,7 @@ pub fn name_analysis(paths: &Vec<PathBuf>) -> Result<(), Box<dyn std::error::Err
|
|||||||
let mut symbol_table = SymbolTable::new();
|
let mut symbol_table = SymbolTable::new();
|
||||||
add_std_core_symbols(&mut symbol_table).expect("Failed to add std::core symbols.");
|
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() {
|
if diagnostics.is_empty() {
|
||||||
println!("Name analysis complete.");
|
println!("Name analysis complete.");
|
||||||
println!("{}", symbol_table);
|
println!("{}", symbol_table);
|
||||||
|
|||||||
@ -334,7 +334,7 @@ fn gather_node<'a>(
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn gather_compilation_unit<'a>(
|
pub fn gather_compilation_unit<'a>(
|
||||||
compilation_unit: &'a mut CompilationUnit,
|
compilation_unit: &'a CompilationUnit,
|
||||||
file_name: &str,
|
file_name: &str,
|
||||||
symbol_table: &mut SymbolTable,
|
symbol_table: &mut SymbolTable,
|
||||||
scope_ids: &mut HashMap<&'a VariableUse, usize>,
|
scope_ids: &mut HashMap<&'a VariableUse, usize>,
|
||||||
|
|||||||
@ -34,7 +34,7 @@ pub mod symbol;
|
|||||||
pub mod symbol_table;
|
pub mod symbol_table;
|
||||||
|
|
||||||
pub fn analyze_names<'a, F: Files<'a, FileId = usize, Name = String>>(
|
pub fn analyze_names<'a, F: Files<'a, FileId = usize, Name = String>>(
|
||||||
compilation_units: &mut [Box<CompilationUnit>],
|
compilation_units: &[Box<CompilationUnit>],
|
||||||
files: &'a F,
|
files: &'a F,
|
||||||
symbol_table: &mut SymbolTable,
|
symbol_table: &mut SymbolTable,
|
||||||
) -> Vec<DmDiagnostic> {
|
) -> 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();
|
let mut scope_ids: HashMap<&VariableUse, usize> = HashMap::new();
|
||||||
|
|
||||||
// gather symbols
|
// 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();
|
let file_name = files.name(compilation_unit.file_id()).unwrap();
|
||||||
gather_compilation_unit(
|
gather_compilation_unit(
|
||||||
compilation_unit,
|
compilation_unit,
|
||||||
@ -54,7 +54,7 @@ pub fn analyze_names<'a, F: Files<'a, FileId = usize, Name = String>>(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// resolve symbols
|
// 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);
|
// resolve_compilation_unit(compilation_unit, symbol_table, &mut diagnostics);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user