Support importing local files in the REPL

This commit is contained in:
Agus Zubiaga 2024-04-26 23:33:14 -03:00
parent e500d664fd
commit 52f84910a7
No known key found for this signature in database
5 changed files with 57 additions and 10 deletions

View file

@ -163,6 +163,8 @@ impl<'a> From<ModuleName<'a>> for roc_module::ident::ModuleName {
}
impl<'a> ModuleName<'a> {
const MODULE_SEPARATOR: char = '.';
pub const fn new(name: &'a str) -> Self {
ModuleName(name)
}
@ -170,6 +172,10 @@ impl<'a> ModuleName<'a> {
pub const fn as_str(&'a self) -> &'a str {
self.0
}
pub fn parts(&'a self) -> impl DoubleEndedIterator<Item = &'a str> {
self.0.split(Self::MODULE_SEPARATOR)
}
}
#[derive(Copy, Clone, PartialEq, Eq, Debug, Hash)]