Skip to content

Commit

Permalink
s/get_mut_module/get_module_mut
Browse files Browse the repository at this point in the history
Signed-off-by: he1pa <[email protected]>
  • Loading branch information
He1pa committed Oct 31, 2024
1 parent e579dbf commit c2a24f2
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion kclvm/ast/src/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ impl Program {
}
}

pub fn get_mut_module(
pub fn get_module_mut(
&self,
module_path: &str,
) -> Result<Option<RwLockWriteGuard<'_, Module>>, &str> {
Expand Down
2 changes: 1 addition & 1 deletion kclvm/parser/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -979,7 +979,7 @@ pub fn parse_program(

let mut modules: HashMap<String, Arc<RwLock<Module>>> = HashMap::new();
for file in files.iter() {
let filename = file.canonicalize().to_str().unwrap().to_string();
let filename = file.path.adjust_canonicalization();
let m_ref = match module_cache.read() {
Ok(module_cache) => module_cache
.ast_cache
Expand Down
2 changes: 1 addition & 1 deletion kclvm/query/src/override.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ pub fn apply_overrides(
if let Some(modules) = prog.pkgs.get(MAIN_PKG) {
for m in modules.iter() {
let mut m = prog
.get_mut_module(m)
.get_module_mut(m)
.expect("Failed to acquire module lock")
.expect(&format!("module {:?} not found in program", m));
if apply_override_on_module(&mut m, o, import_paths)? && print_ast {
Expand Down
8 changes: 4 additions & 4 deletions kclvm/sema/src/pre_process/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ impl ConfigMergeTransformer {
if let Some(modules) = program.pkgs.get(kclvm_ast::MAIN_PKG) {
for (module_id, module) in modules.iter().enumerate() {
let mut module = program
.get_mut_module(module)
.get_module_mut(module)
.expect("Failed to acquire module lock")
.expect(&format!("module {:?} not found in program", module));
let filename = module.filename.to_string();
Expand Down Expand Up @@ -207,7 +207,7 @@ impl ConfigMergeTransformer {
if let Some(modules) = program.pkgs.get(kclvm_ast::MAIN_PKG) {
for (module_id, module) in modules.iter().enumerate() {
let mut module = program
.get_mut_module(module)
.get_module_mut(module)
.expect("Failed to acquire module lock")
.expect(&format!("module {:?} not found in program", module));
if &module.filename == merged_filename && module_id == *merged_id {
Expand Down Expand Up @@ -248,7 +248,7 @@ impl ConfigMergeTransformer {
if let Some(modules) = program.pkgs.get(kclvm_ast::MAIN_PKG) {
for (module_id, module) in modules.iter().enumerate() {
let mut module = program
.get_mut_module(module)
.get_module_mut(module)
.expect("Failed to acquire module lock")
.expect(&format!("module {:?} not found in program", module));
if &module.filename == filename && module_id == *merged_id {
Expand Down Expand Up @@ -292,7 +292,7 @@ impl ConfigMergeTransformer {
if let Some(modules) = program.pkgs.get(kclvm_ast::MAIN_PKG) {
for (i, module) in modules.iter().enumerate() {
let mut module = program
.get_mut_module(module)
.get_module_mut(module)
.expect("Failed to acquire module lock")
.expect(&format!("module {:?} not found in program", module));
let mut delete_index_set: IndexSet<usize> = IndexSet::default();
Expand Down
2 changes: 1 addition & 1 deletion kclvm/sema/src/pre_process/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ pub fn pre_process_program(program: &mut ast::Program, opts: &Options) {
}
for module in modules.iter() {
let mut module = program
.get_mut_module(module)
.get_module_mut(module)
.expect("Failed to acquire module lock")
.expect(&format!("module {:?} not found in program", module));
if pkgpath != kclvm_ast::MAIN_PKG {
Expand Down
2 changes: 1 addition & 1 deletion kclvm/sema/src/resolver/ty_alias.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ pub fn type_alias_pass(
for (pkgpath, modules) in program.pkgs.iter() {
for module in modules.iter() {
let mut module = program
.get_mut_module(module)
.get_module_mut(module)
.expect("Failed to acquire module lock")
.expect(&format!("module {:?} not found in program", module));
if let Some(type_alias_mapping) = type_alias_mapping.get(pkgpath) {
Expand Down
2 changes: 1 addition & 1 deletion kclvm/sema/src/resolver/ty_erasure.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ pub fn type_func_erasure_pass<'ctx>(program: &'ctx mut ast::Program) {
for (_, modules) in program.pkgs.iter() {
for module in modules.iter() {
let mut module = program
.get_mut_module(module)
.get_module_mut(module)
.expect("Failed to acquire module lock")
.expect(&format!("module {:?} not found in program", module));
TypeErasureTransformer::default().walk_module(&mut module);
Expand Down
2 changes: 1 addition & 1 deletion kclvm/tools/src/vet/validator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ pub fn validate(val_opt: ValidateOption) -> Result<bool> {
if let Some(module) = pkg.first() {
let mut m = compile_res
.program
.get_mut_module(module)
.get_module_mut(module)
.expect("Failed to acquire module lock")
.expect(&format!("module {:?} not found in program", module));
m.body.insert(0, assign_stmt);
Expand Down

0 comments on commit c2a24f2

Please sign in to comment.