mirror of
https://github.com/roc-lang/roc.git
synced 2025-07-24 15:03:46 +00:00
Support importing local files in the REPL
This commit is contained in:
parent
e500d664fd
commit
52f84910a7
5 changed files with 57 additions and 10 deletions
|
@ -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)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue