mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-03 00:24:34 +00:00
Generate docs basde on package root .roc file
This commit is contained in:
parent
e549456668
commit
15590fb31b
6 changed files with 115 additions and 188 deletions
|
@ -376,6 +376,12 @@ fn start_phase<'a>(
|
|||
state.cached_types.lock().contains_key(&module_id)
|
||||
};
|
||||
|
||||
let exposed_module_ids = state
|
||||
.platform_data
|
||||
.as_ref()
|
||||
.map(|data| data.exposed_modules)
|
||||
.unwrap_or_default();
|
||||
|
||||
BuildTask::CanonicalizeAndConstrain {
|
||||
parsed,
|
||||
dep_idents,
|
||||
|
@ -384,6 +390,7 @@ fn start_phase<'a>(
|
|||
aliases,
|
||||
abilities_store,
|
||||
skip_constraint_gen,
|
||||
exposed_module_ids,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1159,6 +1166,7 @@ enum BuildTask<'a> {
|
|||
exposed_symbols: VecSet<Symbol>,
|
||||
aliases: MutMap<Symbol, Alias>,
|
||||
abilities_store: PendingAbilitiesStore,
|
||||
exposed_module_ids: &'a [ModuleId],
|
||||
skip_constraint_gen: bool,
|
||||
},
|
||||
Solve {
|
||||
|
@ -4371,7 +4379,7 @@ fn build_header<'a>(
|
|||
};
|
||||
home = module_ids.get_or_insert(&name);
|
||||
|
||||
// Ensure this module has an entry in the exposed_ident_ids map.
|
||||
// Ensure this module has an entry in the ident_ids_by_module map.
|
||||
ident_ids_by_module.get_or_insert(home);
|
||||
|
||||
// For each of our imports, add an entry to deps_by_name
|
||||
|
@ -5209,6 +5217,7 @@ fn canonicalize_and_constrain<'a>(
|
|||
imported_abilities_state: PendingAbilitiesStore,
|
||||
parsed: ParsedModule<'a>,
|
||||
skip_constraint_gen: bool,
|
||||
exposed_module_ids: &[ModuleId],
|
||||
) -> CanAndCon {
|
||||
let canonicalize_start = Instant::now();
|
||||
|
||||
|
@ -5273,17 +5282,24 @@ fn canonicalize_and_constrain<'a>(
|
|||
}
|
||||
HeaderType::Interface { name, .. }
|
||||
| HeaderType::Builtin { name, .. }
|
||||
| HeaderType::Hosted { name, .. } => {
|
||||
| HeaderType::Hosted { name, .. }
|
||||
if exposed_module_ids.contains(&parsed.module_id) =>
|
||||
{
|
||||
let mut scope = module_output.scope.clone();
|
||||
scope.add_docs_imports();
|
||||
let docs = crate::docs::generate_module_docs(
|
||||
scope,
|
||||
name.as_str().into(),
|
||||
&parsed_defs_for_docs,
|
||||
exposed_module_ids,
|
||||
);
|
||||
|
||||
Some(docs)
|
||||
}
|
||||
HeaderType::Interface { .. } | HeaderType::Builtin { .. } | HeaderType::Hosted { .. } => {
|
||||
// This module isn't exposed by the platform, so don't generate docs for it!
|
||||
None
|
||||
}
|
||||
};
|
||||
|
||||
// _before has an underscore because it's unused in --release builds
|
||||
|
@ -6126,6 +6142,7 @@ fn run_task<'a>(
|
|||
aliases,
|
||||
abilities_store,
|
||||
skip_constraint_gen,
|
||||
exposed_module_ids,
|
||||
} => {
|
||||
let can_and_con = canonicalize_and_constrain(
|
||||
arena,
|
||||
|
@ -6136,6 +6153,7 @@ fn run_task<'a>(
|
|||
abilities_store,
|
||||
parsed,
|
||||
skip_constraint_gen,
|
||||
exposed_module_ids,
|
||||
);
|
||||
|
||||
Ok(Msg::CanonicalizedAndConstrained(can_and_con))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue