Skip to content

Commit

Permalink
Merge pull request #643 from luketpeterson/main
Browse files Browse the repository at this point in the history
Fix for !(mod-space top)
  • Loading branch information
luketpeterson authored Mar 29, 2024
2 parents 06a02c3 + 636be52 commit 11b7908
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/src/metta/runner/modules/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,8 @@ impl MettaMod {
/// ModuleLoader can be used to define a module format or to supply programmatically defined modules
pub trait ModuleLoader: std::fmt::Debug + Send + Sync {
/// A function to load the module my making MeTTa API calls. This function will be called by
/// [Metta::get_or_init_module]
/// as a downstream consequence of [Metta::load_module_at_path], [Metta::load_module_direct],
/// [RunContext::load_module], or any other method that leads to the loading of modules
fn load(&self, context: &mut RunContext) -> Result<(), String>;
}

Expand Down
3 changes: 3 additions & 0 deletions lib/src/metta/runner/modules/mod_names.rs
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,9 @@ impl ModNameNode {

/// Parses a module name path into a canonical representation
pub fn normalize_name_path(name: &str) -> Result<String, String> {
if name == TOP_MOD_NAME {
return Ok(TOP_MOD_NAME.to_string());
}
let mut new_name = TOP_MOD_NAME.to_string();
let (_, _, last) = Self::parse_parent_generic(Self::top(), name, &OverlayMap::none(),
|node, _| Some(node),
Expand Down

0 comments on commit 11b7908

Please sign in to comment.