Merge pull request #6685 from roc-lang/repl-import

Support imports in REPL
This commit is contained in:
Anton-4 2024-04-30 19:49:26 +02:00 committed by GitHub
commit c3cabf7840
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 72 additions and 13 deletions

View file

@ -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)]