mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 22:34:45 +00:00
pipe module name into canonicalization of modules
This commit is contained in:
parent
545882f210
commit
1fb746757c
3 changed files with 16 additions and 12 deletions
|
@ -44,6 +44,7 @@ pub struct ModuleOutput {
|
|||
pub fn canonicalize_module_defs<'a, F>(
|
||||
arena: &Bump,
|
||||
loc_defs: &'a [Loc<ast::Def<'a>>],
|
||||
module_name: &roc_parse::header::ModuleNameEnum,
|
||||
home: ModuleId,
|
||||
module_ids: &ModuleIds,
|
||||
exposed_ident_ids: IdentIds,
|
||||
|
|
|
@ -24,8 +24,8 @@ use roc_mono::ir::{
|
|||
};
|
||||
use roc_mono::layout::{Layout, LayoutCache, LayoutProblem};
|
||||
use roc_parse::ast::{self, ExtractSpaces, Spaced, StrLiteral, TypeAnnotation};
|
||||
use roc_parse::header::PackageName;
|
||||
use roc_parse::header::{ExposedName, ImportsEntry, PackageEntry, PlatformHeader, To, TypedIdent};
|
||||
use roc_parse::header::{ModuleNameEnum, PackageName};
|
||||
use roc_parse::ident::UppercaseIdent;
|
||||
use roc_parse::module::module_defs;
|
||||
use roc_parse::parser::{FileError, Parser, SyntaxError};
|
||||
|
@ -2760,15 +2760,6 @@ fn load_from_str<'a>(
|
|||
)
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
enum ModuleNameEnum<'a> {
|
||||
/// A filename
|
||||
App(StrLiteral<'a>),
|
||||
Interface(roc_parse::header::ModuleName<'a>),
|
||||
Hosted(roc_parse::header::ModuleName<'a>),
|
||||
PkgConfig,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
struct HeaderInfo<'a> {
|
||||
loc_name: Loc<ModuleNameEnum<'a>>,
|
||||
|
@ -3680,6 +3671,7 @@ where
|
|||
let canonicalized = canonicalize_module_defs(
|
||||
arena,
|
||||
parsed_defs,
|
||||
&module_name,
|
||||
module_id,
|
||||
module_ids,
|
||||
exposed_ident_ids,
|
||||
|
@ -3702,12 +3694,14 @@ where
|
|||
ModuleNameEnum::PkgConfig => None,
|
||||
ModuleNameEnum::App(_) => None,
|
||||
ModuleNameEnum::Interface(name) | ModuleNameEnum::Hosted(name) => {
|
||||
Some(crate::docs::generate_module_docs(
|
||||
let docs = crate::docs::generate_module_docs(
|
||||
module_output.scope,
|
||||
name.as_str().into(),
|
||||
&module_output.ident_ids,
|
||||
parsed_defs,
|
||||
))
|
||||
);
|
||||
|
||||
Some(docs)
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -47,6 +47,15 @@ impl<'a> ModuleName<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum ModuleNameEnum<'a> {
|
||||
/// A filename
|
||||
App(StrLiteral<'a>),
|
||||
Interface(ModuleName<'a>),
|
||||
Hosted(ModuleName<'a>),
|
||||
PkgConfig,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, PartialEq, Eq, Debug, Hash)]
|
||||
pub struct ExposedName<'a>(&'a str);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue