mirror of
https://github.com/roc-lang/roc.git
synced 2025-07-24 06:55:15 +00:00
Merge pull request #6685 from roc-lang/repl-import
Support imports in REPL
This commit is contained in:
commit
c3cabf7840
5 changed files with 72 additions and 13 deletions
|
@ -176,6 +176,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)
|
||||
}
|
||||
|
@ -183,6 +185,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