use add_dynamically_generated_module in get_or_insert_local_code_index

This commit is contained in:
Mark Thom
2021-02-18 14:15:28 -07:00
parent d69b7f41f2
commit c272e4d1e8

View File

@@ -559,25 +559,20 @@ impl<'a> LoadState<'a> {
.or_insert_with(|| CodeIndex::new(IndexPtr::Undefined)) .or_insert_with(|| CodeIndex::new(IndexPtr::Undefined))
.clone(), .clone(),
None => { None => {
let mut module = Module::new( self.add_dynamically_generated_module(&module_name);
ModuleDecl {
name: module_name.clone(),
exports: vec![],
},
ListingSource::DynamicallyGenerated,
);
let code_index = module match self.wam.indices.modules.get_mut(&module_name) {
.code_dir Some(ref mut module) => {
.entry(key) module
.or_insert_with(|| CodeIndex::new(IndexPtr::Undefined)) .code_dir
.clone(); .entry(key)
.or_insert_with(|| CodeIndex::new(IndexPtr::Undefined))
self.retraction_info .clone()
.push_record(RetractionRecord::AddedModule(module_name.clone())); }
None => {
self.wam.indices.modules.insert(module_name, module); unreachable!()
code_index }
}
} }
} }
} }